Skip to content

Commit

Permalink
ci: Stringify automated registration errors
Browse files Browse the repository at this point in the history
  When `cozy-stack` returns an error response to an OAuth authorization
  request, we throw a Javascript error with the response body.

  However, when the body is a JSON object, we only get its type in the
  error message rather than the content itself.
  By stringifying the body, we make sure its content will be included in
  the error message and thus displayed in the logs or console.
  • Loading branch information
taratatach committed Aug 2, 2024
1 parent 1933830 commit 884398e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dev/remote/automated_registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ const authorize = async authorizeUrl => {
if (redirectUrl) {
return redirectUrl
} else {
throw new Error(`Authorization failed (code ${res.status}):\n ${body}`)
throw new Error(
`Authorization failed (code ${res.status}):\n ${JSON.stringify(body)}`
)
}
}

Expand Down

0 comments on commit 884398e

Please sign in to comment.