kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

Some errors are set in the Response.error field instead of ProcedureResult.error

Cahu opened this issue ยท 1 comments

commented

Aloha !

I'm working on a client for Rust and I'm testing sending calls in batches by adding multiple ProcedureCalls in a single request. The code looks like this:

let client = krpc_mars::RPCClient::connect("Example", "127.0.0.1:50000")?;   

let (bodies, vessel, ut_stream) = mk_rpc_call!(&client, {
    &space_center::get_bodies();
    &space_center::get_active_vessel();
    &krpc_mars::mk_stream(&space_center::get_ut()); // <-- stream request
})?;                                                                         

Since I forgot to connect to the stream server I get the following:

RequestFailure(service: "KRPC" name: "InvalidOperationException" description: "No stream client is connected for this RPC client" stack_trace: " 
at KRPC.Core.AddStream (IClient rpcClient, KRPC.Service.Stream stream, Boolean requireNew) [0x00000] in <filename unknown>:0
at KRPC.Service.KRPC.KRPC.AddStream (KRPC.Service.Messages.ProcedureCall call, Boolean start) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 ")

However, the other two requests are valid and should return a result. Instead, the error is set in the Response message instead of the corresponding ProcedureResult message and the whole batch fails.

commented

Thanks for reporting! Should be fixed in the next release, or if you can't wait for that you can try out this pre-release build: http://krpc.s3-website-us-east-1.amazonaws.com/deploy/bug/procedure-call-errors/1171.1/