On failure to unmarshal msgraph API error, log whole response body #254
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.
Summary
For context, please see https://community.mattermost.com/core/pl/a7m4w3tbufgzdj1trqkt3mj3tw
Here is the error we're currently getting when trying to create a superuser token for the status sync feature:
We're receiving a
400 Bad Request
from Microsoft's API, with a response body that does not match the expectedErrorObject
struct. Since theUnmarshal
fails, we don't have any other context for what actual error occurred.This PR makes it so we log the response body in the case that this unmarshal fails.
This error is originally happening here on line 99:
mattermost-plugin-mscalendar/server/remote/msgraph/call.go
Lines 96 to 104 in 8601bf2
Ticket Link
https://mattermost.atlassian.net/browse/MM-52156