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

refactor: return an error in case response deserialization fails #377

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

uriel-starkware
Copy link
Contributor

@uriel-starkware uriel-starkware commented Jul 7, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@fb92713). Learn more about missing BASE report.
Report is 1 commits behind head on main.

Files Patch % Lines
crates/mempool_infra/src/component_client.rs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #377   +/-   ##
=======================================
  Coverage        ?   80.70%           
=======================================
  Files           ?       35           
  Lines           ?     1622           
  Branches        ?     1622           
=======================================
  Hits            ?     1309           
  Misses          ?      246           
  Partials        ?       67           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @uriel-starkware)


crates/mempool_infra/src/component_client.rs line 125 at r1 (raw file):

    #[error("Got an unexpected response type.")]
    UnexpectedResponse,
    #[error("Could not deserialize response from server.")]

Please change to "server response"

Code quote:

response from server

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @uriel-starkware)


crates/mempool_infra/src/component_client.rs line 96 at r1 (raw file):

            .await
            .map_err(ClientError::ResponseParsingFailure)?;
        deserialize(&body_bytes).map_err(|_e| ClientError::ResponseDeserializationFailure)

Can the error _e be in ClientError::ResponseDeserializationFailure?

Code quote:

.map_err(|_e| ClientError::ResponseDeserializationFailure)

@uriel-starkware uriel-starkware force-pushed the uriel/handle-deser-client branch from 0fa3cf6 to 1b3d8d8 Compare July 7, 2024 08:50
Copy link
Contributor Author

@uriel-starkware uriel-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Itay-Tsabary-Starkware)


crates/mempool_infra/src/component_client.rs line 96 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Can the error _e be in ClientError::ResponseDeserializationFailure?

I can convert it to string, is that fine?


crates/mempool_infra/src/component_client.rs line 125 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Please change to "server response"

ok

@uriel-starkware uriel-starkware force-pushed the uriel/handle-deser-client branch from 1b3d8d8 to a5c6715 Compare July 7, 2024 08:53
@uriel-starkware uriel-starkware force-pushed the uriel/handle-deser-client branch from a5c6715 to d619ad4 Compare July 7, 2024 09:01
Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @uriel-starkware)

@uriel-starkware uriel-starkware merged commit 006d0c3 into main Jul 7, 2024
8 checks passed
@uriel-starkware uriel-starkware deleted the uriel/handle-deser-client branch July 7, 2024 09:03
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.

3 participants