예제 #1
0
		/// <summary>
		///		Initialize new instance with unpacked data.
		/// </summary>
		/// <param name="rpcError">
		///		Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
		///	</param>
		/// <param name="unpackedException">
		///		Exception data from remote MessagePack-RPC server.
		///	</param>
		/// <exception cref="SerializationException">
		///		Cannot deserialize instance from <paramref name="unpackedException"/>.
		/// </exception>
		protected internal RpcException( RpcError rpcError, MessagePackObject unpackedException )
			: this( rpcError, unpackedException.GetString( MessageKeyUtf8 ), unpackedException.GetString( DebugInformationKeyUtf8 ) )
		{
			if ( unpackedException.IsDictionary )
			{
				MessagePackObject mayBeArray;
				if ( unpackedException.AsDictionary().TryGetValue( _remoteExceptionsUtf8, out mayBeArray ) && mayBeArray.IsArray )
				{
					var array = mayBeArray.AsList();
					this._remoteExceptions = new RemoteExceptionInformation[ array.Count ];
					for ( int i = 0; i < this._remoteExceptions.Length; i++ )
					{
						if ( array[ i ].IsList )
						{
							this._remoteExceptions[ i ] = new RemoteExceptionInformation( array[ i ].AsList() );
						}
						else
						{
							// Unexpected type.
							Debug.WriteLine( "Unexepcted ExceptionInformation at {0}, type: {1}, value: \"{2}\".", i, array[ i ].UnderlyingType, array[ i ] );
							this._remoteExceptions[ i ] = new RemoteExceptionInformation( new MessagePackObject[] { array[ i ] } );
						}
					}
				}
			}

#if !SILVERLIGHT && !MONO
			this.RegisterSerializeObjectStateEventHandler();
#endif
		}
예제 #2
0
 public void TestFromIdentifier_Known_SameAsKnown()
 {
     foreach (var prop in typeof(RpcError).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Where(item => item.PropertyType == typeof(RpcError)))
     {
         var target        = prop.GetValue(null, null) as RpcError;
         var viaIdentifier = RpcError.FromIdentifier(target.Identifier, null);
         Assert.That(viaIdentifier, Is.SameAs(target));
         var viaErrorCode = RpcError.FromIdentifier(null, target.ErrorCode);
         Assert.That(viaErrorCode, Is.SameAs(target));
     }
 }
예제 #3
0
 protected static RpcError GetRpcError(IDictionary <string, object> properties)
 {
     if (properties["RpcErrorIdentifier"] == null && properties["RpcErrorCode"] == null)
     {
         return(null);
     }
     else
     {
         return(RpcError.FromIdentifier(( string )properties["RpcErrorIdentifier"], ( int? )properties["RpcErrorCode"]));
     }
 }
예제 #4
0
        public void TestEquals_Null_False()
        {
            var      left  = RpcError.CustomError("ID", 1);
            RpcError right = null;

            Assert.That(left.Equals(right), Is.False);
            Assert.That(left == right, Is.False);
            Assert.That(right == left, Is.False);
            Assert.That(left != right, Is.True);
            Assert.That(right != left, Is.True);
        }
예제 #5
0
        public void TestCustomError_NonNullId_ZeroErrorCode_AsIs()
        {
            var identifier = Guid.NewGuid().ToString();
            var errorCode  = 0;
            var target     = RpcError.CustomError(identifier, errorCode);

            Assert.That(target, Is.Not.Null);
            Assert.That(target.Identifier, Is.EqualTo(identifier));
            Assert.That(target.ErrorCode, Is.EqualTo(errorCode));
            Assert.That(target.DefaultMessage, Is.Not.Null.And.Not.Empty);
            Assert.That(target.DefaultMessageInvariant, Is.Not.Null.And.Not.Empty);
        }
예제 #6
0
        /// <summary>
        ///		Initializes new instance.
        /// </summary>
        /// <param name="error">Error information of the error.</param>
        /// <param name="detail">Unpacked detailed information of the error which was occurred in remote endpoint.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="error"/> is null.
        /// </exception>
        public RpcErrorMessage(RpcError error, MessagePackObject detail)
        {
            if (error == null)
            {
                throw new ArgumentNullException("error");
            }

            Contract.EndContractBlock();

            this._error  = error;
            this._detail = detail;
        }
예제 #7
0
        /// <summary>
        ///		Initialize new instance.
        /// </summary>
        /// <param name="error">Error information of the error.</param>
        /// <param name="detail">Unpacked detailed information of the error which was occurred in remote endpoint.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="error"/> is null.
        /// </exception>
        public RpcErrorMessage( RpcError error, MessagePackObject detail )
        {
            if ( error == null )
            {
                throw new ArgumentNullException( "error" );
            }

            Contract.EndContractBlock();

            this._error = error;
            this._detail = detail;
        }
예제 #8
0
        public void TestEquals_DifferId_DifferCode_False()
        {
            var left  = RpcError.CustomError("ID", 1);
            var right = RpcError.CustomError("ID0", 2);

            Assert.That(left.Equals(right), Is.False);
            Assert.That(right.Equals(left), Is.False);
            Assert.That(left == right, Is.False);
            Assert.That(right == left, Is.False);
            Assert.That(left != right, Is.True);
            Assert.That(right != left, Is.True);
        }
예제 #9
0
        public void TestEquals_SameId_SameCode_True()
        {
            var left  = RpcError.CustomError("ID", 1);
            var right = RpcError.CustomError("ID", 1);

            Assert.That(left, Is.Not.SameAs(right), "Precondition");
            Assert.That(left.Equals(right), Is.True);
            Assert.That(right.Equals(left), Is.True);
            Assert.That(left == right, Is.True);
            Assert.That(right == left, Is.True);
            Assert.That(left != right, Is.False);
            Assert.That(right != left, Is.False);
        }
예제 #10
0
        /// <summary>
        ///		Initialize new instance.
        /// </summary>
        /// <param name="error">Error information of the error.</param>
        /// <param name="description">Description of the error which was occurred in local.</param>
        /// <param name="debugInformation">Detailed debug information of the error which was occurred in local.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="error"/> is null.
        /// </exception>
        public RpcErrorMessage( RpcError error, string description, string debugInformation )
        {
            if ( error == null )
            {
                throw new ArgumentNullException( "error" );
            }

            Contract.EndContractBlock();

            this._error = error;
            var data = new Dictionary<MessagePackObject, MessagePackObject>();
            data.Add( RpcException.MessageKeyUtf8, description );
            data.Add( RpcException.DebugInformationKeyUtf8, debugInformation );
            this._detail = new MessagePackObject( data );
        }
 /// <summary>
 ///		Initialize new sintance with unpacked data.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="unpackedException">
 ///		Exception data from remote MessagePack-RPC server.
 ///	</param>
 /// <exception cref="SerializationException">
 ///		Cannot deserialize instance from <paramref name="unpackedException"/>.
 /// </exception>
 protected internal RpcException( RpcError rpcError, MessagePackObject unpackedException )
     : this(rpcError, GetString( unpackedException, MessageKeyUtf8, true ), GetString( unpackedException, DebugInformationKeyUtf8, false ))
 {
     IList<MessagePackObject> array;
     if ( MessagePackObjectDictionary.TryGetArray( unpackedException, _remoteExceptionsUtf8, null, out array ) )
     {
         try
         {
             this._remoteExceptions = new RemoteExceptionInformation[ array.Count ];
             for ( int i = 0; i < this._remoteExceptions.Length; i++ )
             {
                 this._remoteExceptions[ i ] = new RemoteExceptionInformation( array[ i ].AsList() );
             }
         }
         catch ( InvalidOperationException ex )
         {
             throw new SerializationException( "Failed to deserialize remote exception information", ex );
         }
     }
 }
예제 #12
0
        public void TestFromIdentifier_Unknown_AsCustom()
        {
            foreach (var prop in typeof(RpcError).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Where(item => item.PropertyType == typeof(RpcError)))
            {
                var target        = prop.GetValue(null, null) as RpcError;
                var viaIdentifier = RpcError.FromIdentifier(target.Identifier, target.ErrorCode * -1);
                Assert.That(viaIdentifier, Is.Not.Null);
                Assert.That(viaIdentifier, Is.SameAs(target));

                var viaErrorCode = RpcError.FromIdentifier(target.Identifier + "A", target.ErrorCode);
                Assert.That(viaErrorCode, Is.Not.Null);
                Assert.That(viaErrorCode, Is.SameAs(target));

                var custom = RpcError.FromIdentifier(target.Identifier + "A", Math.Abs(target.ErrorCode) % 1000);
                Assert.That(custom, Is.Not.Null);
                Assert.That(custom, Is.Not.SameAs(target));
                Assert.That(custom.Identifier, Is.EqualTo(target.Identifier + "A"));
                Assert.That(custom.ErrorCode, Is.EqualTo(Math.Abs(target.ErrorCode) % 1000));
            }
        }
예제 #13
0
 public void OnConnectError( RpcError rpcError, Exception exception, bool completedSynchronously, object asyncState )
 {
     var handler = this.ConnectError;
     if ( handler != null )
     {
         handler( rpcError, exception, completedSynchronously, asyncState );
     }
 }
예제 #14
0
 public void TestCustomError_NoNullId_UnasignedNegative()
 {
     var target = RpcError.CustomError("A", -1);
 }
예제 #15
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with the default error message.
		/// </summary>
		/// <param name="rpcError">
		///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
		///	</param>
		public RpcServerUnavailableException( RpcError rpcError ) : this( rpcError, null, null, null ) { }
예제 #16
0
 protected virtual TRpcException NewRpcException(RpcError rpcError, MessagePackObject unpackedException)
 {
     return(( TRpcException )typeof(TRpcException).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(RpcError), typeof(MessagePackObject) }, null).Invoke(new object[] { rpcError, unpackedException }));
 }
예제 #17
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with the default error message.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 public RpcServerUnavailableException(RpcError rpcError) : this(rpcError, null, null, null)
 {
 }
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcFaultException"/> class with the unpacked data.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="unpackedException">
 ///		Exception data from remote MessagePack-RPC server.
 ///	</param>
 /// <exception cref="SerializationException">
 ///		Cannot deserialize instance from <paramref name="unpackedException"/>.
 /// </exception>
 protected internal RpcFaultException(RpcError rpcError, MessagePackObject unpackedException)
     : base(rpcError, unpackedException)
 {
 }
예제 #19
0
 protected static IDictionary <string, object> SetRpcError(IDictionary <string, object> properties, RpcError rpcError)
 {
     properties["RpcErrorIdentifier"] = rpcError == null ? null : rpcError.Identifier;
     properties["RpcErrorCode"]       = rpcError == null ? default(int?) : rpcError.ErrorCode;
     return(properties);
 }
예제 #20
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <param name="inner">
 ///		Exception which caused this error.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcServerUnavailableException(RpcError rpcError, string message, string debugInformation, Exception inner)
     : base(rpcError ?? RpcError.ServerError, message, debugInformation, inner)
 {
 }
예제 #21
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception. 
		/// </summary>
		/// <param name="rpcError">
		///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
		///	</param>
		/// <param name="message">
		///		Error message to desribe condition. Note that this message should not include security related information.
		///	</param>
		/// <param name="debugInformation">
		///		Debug information of error.
		///		This value can be null for security reason, and its contents are for developers, not end users.
		/// </param>
		/// <param name="inner">
		///		Exception which caused this error.
		/// </param>
		/// <remarks>
		///		<para>
		///			For example, if some exception is occurred in server application,
		///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
		///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
		///		</para>
		///		<para>
		///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
		///			So you should specify some error handler to instrument it (e.g. logging handler).
		///		</para>
		/// </remarks>
		public RpcServerUnavailableException( RpcError rpcError, string message, string debugInformation, Exception inner )
			: base( rpcError ?? RpcError.ServerError, message, debugInformation, inner ) { }
예제 #22
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcFaultException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception. 
		/// </summary>
		/// <param name="rpcError">
		///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
		///	</param>
		/// <param name="message">
		///		Error message to desribe condition. Note that this message should not include security related information.
		///	</param>
		/// <param name="debugInformation">
		///		Debug information of error.
		///		This value can be null for security reason, and its contents are for developers, not end users.
		/// </param>
		/// <param name="inner">
		///		Exception which caused this error.
		/// </param>
		/// <remarks>
		///		<para>
		///			For example, if some exception is occurred in server application,
		///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
		///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
		///		</para>
		///		<para>
		///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
		///			So you should specify some error handler to instrument it (e.g. logging handler).
		///		</para>
		/// </remarks>
		public RpcFaultException( RpcError rpcError, string message, string debugInformation, Exception inner ) : base( rpcError, message, debugInformation, inner ) { }
예제 #23
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcFaultException"/> class with the unpacked data.
		/// </summary>
		/// <param name="rpcError">
		///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
		///	</param>
		/// <param name="unpackedException">
		///		Exception data from remote MessagePack-RPC server.
		///	</param>
		/// <exception cref="SerializationException">
		///		Cannot deserialize instance from <paramref name="unpackedException"/>.
		/// </exception>
		protected internal RpcFaultException( RpcError rpcError, MessagePackObject unpackedException )
			: base( rpcError, unpackedException ) { }
예제 #24
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with a specified error message.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcServerUnavailableException(RpcError rpcError, string message, string debugInformation)
     : this(rpcError, message, debugInformation, null)
 {
 }
 protected override RpcArgumentException NewRpcException(RpcError rpcError, MessagePackObject unpackedException)
 {
     return(new RpcArgumentException(unpackedException));
 }
 protected override UnexpcetedRpcException NewRpcException(RpcError rpcError, MessagePackObject unpackedException)
 {
     Assert.Ignore("UnexpcetedRpcException does not handle this behavior in the first place.");
     return(null);
 }
예제 #27
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcException"/> class with a specified error message.
 /// </summary>
 /// <param name="rpcError">
 ///		The metadata of the error. If <c>null</c> is specified, the <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		The error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		The debug information of the error.
 ///		This value can be <c>null</c> for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcException(RpcError rpcError, string message, string debugInformation) : this(rpcError, message, debugInformation, null)
 {
 }
 /// <summary>
 ///		Initialize new instance which represents specified error.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>		
 public RpcServerUnavailableException( RpcError rpcError, string message, string debugInformation )
     : base(rpcError, message, debugInformation)
 {
 }
예제 #29
0
 protected RpcException NewRpcException(RpcError rpcError, string message, string debugInformation)
 {
     return(new RpcException(rpcError, message, debugInformation));
 }
예제 #30
0
 public void TestCustomError_WhiteSpaceId()
 {
     var target = RpcError.CustomError(" ", 0);
 }
 /// <summary>
 ///		Initialize new sintance with unpacked data.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="unpackedException">
 ///		Exception data from remote MessagePack-RPC server.
 ///	</param>
 /// <exception cref="SerializationException">
 ///		Cannot deserialize instance from <paramref name="unpackedException"/>.
 /// </exception>
 internal RpcServerUnavailableException( RpcError rpcError, MessagePackObject unpackedException )
     : base(rpcError, unpackedException)
 {
 }
예제 #32
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcServerUnavailableException"/> class with the unpacked data.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="unpackedException">
 ///		Exception data from remote MessagePack-RPC server.
 ///	</param>
 /// <exception cref="SerializationException">
 ///		Cannot deserialize instance from <paramref name="unpackedException"/>.
 /// </exception>
 internal RpcServerUnavailableException(RpcError rpcError, MessagePackObject unpackedException) : base(rpcError, unpackedException)
 {
 }
예제 #33
0
 /// <summary>
 ///		Initialize new instance which represents specified error with specified message and inner exception.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <param name="inner">
 ///		Exception which caused this error.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcException( RpcError rpcError, string message, string debugInformation, Exception inner )
     : base(message, inner)
 {
     this._rpcError = rpcError ?? RpcError.RemoteRuntimeError;
     this._debugInformation = debugInformation;
 }
 /// <summary>
 ///		Initialize new instance which represents specified error.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 public RpcServerUnavailableException(RpcError rpcError)
     : this(rpcError, "MessagePack-RPC destination server is unavailable.", null)
 {
 }
예제 #35
0
 public void TestCustomError_NullId()
 {
     var target = RpcError.CustomError(null, 0);
 }
예제 #36
0
 /// <summary>
 ///		Initialize new instance which represents specified error with specified message..
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 public RpcFaultException( RpcError rpcError )
     : base(rpcError, "MessagePack-RPC destination server thrown exception.", null)
 {
 }
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcFaultException"/> class with a specified error message.
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="RpcException.DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcFaultException(RpcError rpcError, string message, string debugInformation) : base(rpcError, message, debugInformation)
 {
 }
예제 #38
0
 public void TestCustomError_EmptyId()
 {
     var target = RpcError.CustomError(String.Empty, 0);
 }
예제 #39
0
 protected override RpcMissingMethodException NewRpcException(RpcError rpcError, MessagePackObject unpackedException)
 {
     return(new RpcMissingMethodException(unpackedException));
 }
예제 #40
0
 /// <summary>
 ///		Initialize new instance which represents specified error with specified message..
 /// </summary>
 /// <param name="rpcError">
 ///		Metadata of error. If you specify null, <see cref="MsgPack.Rpc.RpcError.RemoteRuntimeError"/> is used.
 ///	</param>
 /// <param name="message">
 ///		Error message to desribe condition. Note that this message should not include security related information.
 ///	</param>
 /// <param name="debugInformation">
 ///		Debug information of error.
 ///		This value can be null for security reason, and its contents are for developers, not end users.
 /// </param>
 /// <remarks>
 ///		<para>
 ///			For example, if some exception is occurred in server application,
 ///			the value of <see cref="Exception.ToString()"/> should specify for <paramref name="debugInformation"/>.
 ///			And then, user-friendly, safe message should be specified to <paramref name="message"/> like 'Internal Error."
 ///		</para>
 ///		<para>
 ///			MessagePack-RPC for CLI runtime does not propagate <see cref="DebugInformation"/> for remote endpoint.
 ///			So you should specify some error handler to instrument it (e.g. logging handler).
 ///		</para>
 /// </remarks>
 public RpcException( RpcError rpcError, string message, string debugInformation )
     : this(rpcError, message, debugInformation, null)
 {
 }