-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more context when failing to unmarshal JSON
As mentioned in #830, we occasionally have a situation where non-JSON data comes back to a client even though this is not supposed to happen. Unfortunately, when it does, the error message produced by Go isn't very good and doesn't help much with debugging. Here we add a new helper function for unmarshaling JSON in standard or error responses that behaves normally in the normal cases, and in case of a failure, adds more context to the standard library's error and logs.
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters