feat: Add response body or detail to errors#70
Conversation
|
Thoughts on tackling the test issues welcome - hit the same locally on |
|
fixed the catalog api builder issue. rebase and let's see some 🟢 |
The error message shown for a ClientError or ServerError includes only the status code, excluding the usually verbose detail returned by the API. Add the detail of a JSON response if it exists, or body of a string response, to the error message.
448a700 to
b4ca48e
Compare
|
TIL that |
| @@ -1,4 +1,4 @@ | |||
| #!/bin/sh | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
is there a reason to use bash? and if so, it must be called through /usr/bin/env as it's location can be different between OS, while /bin/sh is pretty much guaranteed to be there.
There was a problem hiding this comment.
set -eo pipefail is a bash command - none of the scripts were valid sh scripts and crashed immediately for me.
There was a problem hiding this comment.
(do Macs ship with a custom/aliased sh meaning it supports bash semantics? I was surprised this hadn't been noticed before)
|
|
||
| def __init__( | ||
| self, | ||
| message: str, |
There was a problem hiding this comment.
so no way to override anymore, even if we wanted, and changing the exception semantics as shown by massaging the tests into the new shape?
There was a problem hiding this comment.
What use case do you have in mind for modifying the message?
The alternative I initially tried was managing the message setting each time the error is raised (well, created and put into an Err), but there's many places to do that across four different client implementations, which didn't seem right for a unified "report the error message as well as error code" change.
The error message shown for a ClientError or ServerError includes only the status code, excluding the usually verbose detail returned by the API.
Add the detail of a JSON response if it exists, or body of a string response, to the error message.