Inheritance: ArgumentException
Ejemplo n.º 1
0
		// Copy constructor for debugger proxy
		private MessagePackString( MessagePackString other )
		{
			this._encoded = other._encoded;
			this._decoded = other._decoded;
			this._decodingError = other._decodingError;
			this._type = other._type;
		}
        public void Ctor()
        {
            DecoderFallbackException ex = new DecoderFallbackException();
            Assert.Null(ex.BytesUnknown);
            Assert.Equal(default(int), ex.Index);
            Assert.Null(ex.StackTrace);
            Assert.Null(ex.InnerException);
            Assert.Equal(0, ex.Data.Count);
            ArgumentException arg = new ArgumentException();

            Assert.Equal(ex.Message, arg.Message);
        }
Ejemplo n.º 3
0
		public MessagePackString( byte[] encoded, bool isBinary )
		{
#if !UNITY
			Contract.Assert( encoded != null );
#endif // !UNITY
			this._encoded = encoded;
			this._type = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
			if ( isBinary )
			{
				this._decodingError = IsBinary;
			}
		}
        public void Ctor2()
        {
            string message = "Test message.";
            DecoderFallbackException ex = new DecoderFallbackException(message);
            Assert.Null(ex.BytesUnknown);
            Assert.Equal(default(int), ex.Index);
            Assert.Null(ex.StackTrace);
            Assert.Null(ex.InnerException);
            Assert.Equal(0, ex.Data.Count);
            Assert.Equal(ex.Message, message);

            message = "";
            ex = new DecoderFallbackException(message);
            Assert.Null(ex.BytesUnknown);
            Assert.Equal(default(int), ex.Index);
            Assert.Equal(message, ex.Message);
        }
        public void Ctor3()
        {
            string message = "Test message.";
            string innerMsg = "Invalid Op Message.";
            Exception innerException = new InvalidOperationException(innerMsg);
            DecoderFallbackException ex = new DecoderFallbackException(message, innerException);
            Assert.Null(ex.BytesUnknown);
            Assert.Equal(default(int), ex.Index);
            Assert.Null(ex.StackTrace);
            Assert.Equal(0, ex.Data.Count);
            Assert.Equal(innerException, ex.InnerException);
            Assert.Equal(innerMsg, ex.InnerException.Message);
            Assert.Equal(message, ex.Message);

            message = "";
            ex = new DecoderFallbackException(message, null);
            Assert.Null(ex.BytesUnknown);
            Assert.Equal(default(int), ex.Index);
            Assert.Equal(message, ex.Message);
            Assert.Null(ex.InnerException);
        }
Ejemplo n.º 6
0
		private void DecodeIfNeeded()
		{
			if ( this._decoded != null )
			{
				return;
			}

			if ( this._encoded == null )
			{
				return;
			}

			if ( this._type != BinaryType.Unknwon )
			{
				return;
			}

			try
			{
				this._decoded = MessagePackConvert.DecodeStringStrict( this._encoded );
				this._type = BinaryType.String;
			}
			catch ( DecoderFallbackException ex )
			{
				this._decodingError = ex;
				this._type = BinaryType.Blob;
			}
		}
Ejemplo n.º 7
0
 public static Exception/*!*/ CreateArgumentError(DecoderFallbackException/*!*/ e, RubyEncoding/*!*/ encoding) {
     return RubyExceptions.CreateArgumentError(String.Format("invalid byte sequence {0} in {1}",
         BitConverter.ToString(e.BytesUnknown), encoding));
 }
Ejemplo n.º 8
0
 /*!*/
 public static Exception CreateTranscodingError(DecoderFallbackException/*!*/ e, RubyEncoding/*!*/ fromEncoding, RubyEncoding/*!*/ toEncoding)
 {
     throw new UndefinedConversionError(
         FormatMessage(
             "\"{0}\" to {2} in conversion from {1} to UTF-8 to {2}",
             BitConverter.ToString(e.BytesUnknown),
             fromEncoding,
             toEncoding
         )
     );
 }
Ejemplo n.º 9
0
 /*!*/
 public static Exception CreateInvalidByteSequenceError(DecoderFallbackException/*!*/ e, RubyEncoding/*!*/ encoding)
 {
     return new InvalidByteSequenceError(
         FormatMessage("invalid byte sequence {0} on {1}", BitConverter.ToString(e.BytesUnknown), encoding)
     );
 }
Ejemplo n.º 10
0
		public MessagePackString( byte[] encoded, bool isBinary )
		{
			Contract.Assert( encoded != null, "encoded != null" );

			this._encoded = encoded;
			this._type = isBinary ? BinaryType.Blob : BinaryType.Unknwon;
			if ( isBinary )
			{
				this._decodingError = IsBinary;
			}
		}