Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include error code in RpcLogger #1135

Merged
merged 10 commits into from
Jun 2, 2023
Merged

fix: include error code in RpcLogger #1135

merged 10 commits into from
Jun 2, 2023

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented May 26, 2023

Close #1129

In addition it contains a bug fix that were introduced by the IntoResponse trait and I forgot to check the outcome from the ResponsePayload where the user could inject there own JSON-RPC error codes etc.

Thanks to @wlmyng for spotting the bug.

@niklasad1 niklasad1 requested a review from a team as a code owner May 26, 2023 09:14
@niklasad1 niklasad1 changed the title fix: include error code in RpcLogger and correct JSON-RPC errors was reported as success fix: include error code in RpcLogger May 26, 2023
@@ -154,12 +159,16 @@ async fn ws_server_logger() {
let res: Result<String, Error> = client.request("unknown_method", rpc_params![]).await;
assert!(res.is_err());

let res: Result<String, Error> = client.request("err", rpc_params![]).await;
Copy link
Member Author

@niklasad1 niklasad1 May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded the test for failed RPC calls too

@wlmyng
Copy link

wlmyng commented May 26, 2023

Thank you for looking into this!

core/src/server/helpers.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

core/src/server/helpers.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@niklasad1 niklasad1 merged commit 78c85e8 into master Jun 2, 2023
@niklasad1 niklasad1 deleted the na-fix-1129 branch June 2, 2023 10:46
@lexnv lexnv mentioned this pull request Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: have jsonrpsee::server::logger return result as RpcResult instead of a string?
4 participants