fix: store raw response in APIError during JSON parsing #294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change
Type of Change
Been meaning to dig into this one for a while... :-) When working with endpoints that give JSON responses,
raw_response
was being returned as an empty string, for example:This change just makes sure we always output the raw response. I think it fails because the
APIError
struct does not match the fields we get from a Jamf Pro JSON error response. But I didn't want to change that in case it breaks response handling from other APIs this client is used with.Now a TF error looks like this instead (populated
raw_response
field) which is extremely helpful for debugging/troubleshooting provider/API/TF module issues downstream:Please DELETE options that are not relevant.
Checklist