Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
jsonrpsee
Commits
f3a36035
Unverified
Commit
f3a36035
authored
May 19, 2022
by
Niklas Adolfsson
Committed by
GitHub
May 19, 2022
Browse files
rpc_module: remove expect in `fn call` (#774)
parent
75dc45f8
Pipeline
#194706
passed with stages
in 5 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/src/server/rpc_module.rs
View file @
f3a36035
...
...
@@ -355,15 +355,17 @@ impl Methods {
tracing
::
trace!
(
"[Methods::call] Calling method: {:?}, params: {:?}"
,
method
,
params
);
let
(
resp
,
_
,
_
)
=
self
.inner_call
(
req
)
.await
;
if
let
Ok
(
res
)
=
serde_json
::
from_str
::
<
Response
<
T
>>
(
&
resp
)
{
return
Ok
(
res
.result
);
}
if
let
Ok
(
err
)
=
serde_json
::
from_str
::
<
ErrorResponse
>
(
&
resp
)
{
return
Err
(
Error
::
Call
(
CallError
::
Custom
(
err
.error_object
()
.clone
()
.into_owned
())));
}
unreachable!
(
"Invalid JSON-RPC response is not possible using jsonrpsee; this is bug please file an issue"
);
let
res
=
match
serde_json
::
from_str
::
<
Response
<
T
>>
(
&
resp
)
{
Ok
(
res
)
=>
Ok
(
res
.result
),
Err
(
e
)
=>
{
if
let
Ok
(
err
)
=
serde_json
::
from_str
::
<
ErrorResponse
>
(
&
resp
)
{
Err
(
Error
::
Call
(
CallError
::
Custom
(
err
.error_object
()
.clone
()
.into_owned
())))
}
else
{
Err
(
e
.into
())
}
}
};
res
}
/// Make a request (JSON-RPC method call or subscription) by using raw JSON.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment