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

Move error decoding out of Client, support custom decoders #273

Open
sfackler opened this issue Dec 1, 2023 · 4 comments
Open

Move error decoding out of Client, support custom decoders #273

sfackler opened this issue Dec 1, 2023 · 4 comments

Comments

@TheKeveloper
Copy link

It seems to me like our DeserializeResponse and AsyncDeserializeResponse already force custom error decoding by returning a Result in deserialize. I guess one small improvement would be to make the error type generic instead of a conjure error if we wanted to handle arbitrary types of errors?

@sfackler
Copy link
Member Author

sfackler commented Jan 2, 2024

The issue here is that the Client is currently internally responsible for converting all non-2xx responses into Errs. If we moved or disabled that we'd be able to allow the caller to control that logic more directly. I'm not so concerned about the Rust error type.

@TheKeveloper
Copy link

Ah I think I see. So we'd want to restrict the errors returned by Client to be just transport errors, then update the response deserializer implementations to decode the raw response status code and return an error if one should be returned. Then we'd want to update the client implementation in conjure-rust-runtime to avoid parsing the status code in an error and instead just let that be handled downstream.

Is that generally what you were thinking?

@sfackler
Copy link
Member Author

sfackler commented Jan 2, 2024

Yep, though I think it'll take some design work to figure out how it should interact with Conjure's internal retry logic.

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

No branches or pull requests

2 participants