Replies: 1 comment 1 reply
-
That is exactly how I would have suggested to achieve this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This code sends a request and parse the json response with well-defined error cases.
Now I want to report the body in the error contexts, and the code suddenly gets much more complex.
(When the server returns an error, it sends the reason in its body:
{'error': 'credential expired'}
)Since the error from
.json()
does not contain the body, this is hard-to-read, verbose, duplicated code.Any idea to gracefully achieve this?
Beta Was this translation helpful? Give feedback.
All reactions