-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Improved diagnostic for invalid JSON? #77
Comments
So right now we're just attaching the |
If a textual representation is possible, I think that would be preferable in an error message. What about attempting to decode it as a string first, then falling back to just attaching the data? Or attaching data anyway, and optionally decoding as a string? |
I'm just not sure that's an assumption we can make? I'm also less concerned with just being able to print it quickly and more interested in giving the end user the ability to debug with as much info as possible. Seems like the end user could |
Here's where I'm coming from: if I'm debugging, and an error occurs, and I can immediately see the details of the response that failed, that's super valuable to me. If I've got an opaque blob of data and I have to go decode it myself in the debugger or insert print statements or something, it's less convenient.
Maybe it doesn't have to be either/or? I kind of think of the string decoding as a progressive enhancement, which doesn't necessarily need to replace the raw data. It's also possible that string decoding could be a debug-builds-only feature. |
Sometimes I get an invalid JSON response from the API and it's not clear why (for example, a HTML error page where there would normally be a JSON body). Here's the error message I currently see:
I think it would be useful to see the actual response decoded as a string in this case. Would that be a useful addition to Swish?
The text was updated successfully, but these errors were encountered: