You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1057 introduced new a trait for method call responses however there is a an edge-case where the parameter parsing in the proc macro code assumes it can't return Err(e.into) this doesn't work for a type which isn't a Result and the removal of CallError/jsonrpsee::core::Error needs an extra From impl.
These needs to be fixed before releasing in v0.18 and ideally the params parsing could just return PartialResponse directly as handled for subscriptions as well.
Example with the custom error type
pubstructMyError;implFrom<MyError>forErrorObjectOwned{fnfrom(_:MyError) -> Self{ErrorObject::owned(1,"my_error",None::<()>)}}// This is annoying and shouldn't be needed..implFrom<ErrorObjectOwned>forMyError{fnfrom(_:ErrorObjectOwned) -> MyError{MyError}}#[rpc(server, client, namespace = "t")]pubtraitApi{/// Async method call example.#[method(name = "getKeys")]asyncfnf(&self,x:usize) -> Result<usize,MyError>;}
Example with the custom return type
// Serialize impl is not used as the responses are sent out as error.#[derive(Serialize,Clone)]pubenumCustomError{One,Two{custom_data:u32},}implIntoResponseforCustomError{typeOutput = Self;fninto_response(self) -> ResponsePayload<'static,Self::Output>{todo!()}}#[rpc(server)]pubtraitRpc{// This won't compile as it would return `Result<usize, ErrorObject>` when parsing `x` in the call#[method(name = "method1")]asyncfnmethod1(&self,x:usize) -> CustomError;}
The text was updated successfully, but these errors were encountered:
#1057 introduced new a trait for method call responses however there is a an edge-case where the parameter parsing in the
proc macro code
assumes it can't return Err(e.into) this doesn't work for a type which isn't aResult
and the removal ofCallError/jsonrpsee::core::Error
needs an extraFrom
impl.These needs to be fixed before releasing in v0.18 and ideally the params parsing could just return
PartialResponse
directly as handled for subscriptions as well.Example with the custom error type
Example with the custom return type
The text was updated successfully, but these errors were encountered: