@@ -78,9 +78,9 @@ private async Task ApplyAsync(RpcHeader header, Envelope envelope) {
7878 try {
7979 req = serializer . DeserializeRequest ( envelope . Body , ( i , o ) => RpcArgument . FromMember ( GetMember ( i , o ) ) ) ;
8080 } catch ( KeyNotFoundException ) {
81- res = new RpcResponse ( "InterfaceNotFound" , "The interface or operation could not be found" ) ;
81+ res = new RpcResponse ( "InterfaceNotFound" , "The interface or operation could not be found" , null ) ;
8282 } catch ( Exception ex ) {
83- res = new RpcResponse ( "ArgumentInvalid" , string . Format ( "The request format is invalid: {0}" , ex . Message ) ) ;
83+ res = new RpcResponse ( "ArgumentInvalid" , string . Format ( "The request format is invalid: {0}" , ex . Message ) , null ) ;
8484 }
8585
8686 // apply single request
@@ -90,7 +90,7 @@ private async Task ApplyAsync(RpcHeader header, Envelope envelope) {
9090 if ( req != null )
9191 memberInfo = GetMember ( req . Interface , req . Operation ) ;
9292 } catch ( KeyNotFoundException ) {
93- res = new RpcResponse ( "OperationNotFound" , "The interface or operation could not be found" ) ;
93+ res = new RpcResponse ( "OperationNotFound" , "The interface or operation could not be found" , null ) ;
9494 }
9595
9696 // get operation information
@@ -107,7 +107,7 @@ private async Task ApplyAsync(RpcHeader header, Envelope envelope) {
107107
108108 // check if they have a response ID if no reply isn't enabled
109109 if ( ! noReply && envelope . ID == Guid . Empty )
110- res = new RpcResponse ( "InvalidOperation" , "The envelope does not specify a correlation ID" ) ;
110+ res = new RpcResponse ( "InvalidOperation" , "The envelope does not specify a correlation ID" , null ) ;
111111
112112 // apply request if we don't have a response already, typically an error
113113 if ( res == null ) {
@@ -192,7 +192,7 @@ private MemberInfo GetMember(string @interface, string operation) {
192192 private async Task < RpcResponse > ApplyRequestAsync ( RpcRequest req , MemberInfo member ) {
193193 // find interface behaviour
194194 if ( ! _behaviours . TryGetValue ( req . Interface , out Binding binding ) )
195- return new RpcResponse ( "InterfaceNotFound" , "The interface binding could not be found" ) ;
195+ return new RpcResponse ( "InterfaceNotFound" , "The interface binding could not be found" , null ) ;
196196
197197 // get method info
198198 MethodInfo operationMethod = member as MethodInfo ;
@@ -205,7 +205,7 @@ private async Task<RpcResponse> ApplyRequestAsync(RpcRequest req, MemberInfo mem
205205 for ( int i = 0 ; i < methodArgs . Length ; i ++ ) {
206206 if ( ! req . Arguments . TryGetValue ( methodParams [ i ] . Name , out methodArgs [ i ] ) ) {
207207 if ( ! methodParams [ i ] . IsOptional )
208- return new RpcResponse ( "ArgumentRequired" , string . Format ( "The argument {0} is not optional" , methodParams [ i ] . Name ) ) ;
208+ return new RpcResponse ( "ArgumentRequired" , string . Format ( "The argument {0} is not optional" , methodParams [ i ] . Name ) , null ) ;
209209 }
210210 }
211211
@@ -216,9 +216,9 @@ private async Task<RpcResponse> ApplyRequestAsync(RpcRequest req, MemberInfo mem
216216 methodResult = operationMethod . Invoke ( binding . Behaviour , methodArgs ) ;
217217 await ( ( Task ) methodResult ) . ConfigureAwait ( false ) ;
218218 } catch ( RpcException ex ) {
219- return new RpcResponse ( ex . Code , ex . Message ) ;
219+ return new RpcResponse ( ex . Code , ex . Message , ex . ToString ( ) ) ;
220220 } catch ( Exception ex ) {
221- return new RpcResponse ( "Exception" , ex . ToString ( ) ) ;
221+ return new RpcResponse ( "Exception" , ex . Message , ex . ToString ( ) ) ;
222222 }
223223
224224 // check if the operation returns anything
@@ -416,7 +416,7 @@ public Task<InterfaceInformation> GetInterfaceInfo(string @interface) {
416416
417417 lock ( _behaviour . _behaviours ) {
418418 if ( ! _behaviour . _behaviours . TryGetValue ( @interface , out binding ) || ! binding . AllowIntrospection )
419- throw new RpcException ( "InterfaceNotFound" , "The interface does not exist" ) ;
419+ throw new RpcException ( "InterfaceNotFound" , "The interface does not exist" , null ) ;
420420 }
421421
422422 return Task . FromResult ( binding . Introspection ) ;
0 commit comments