From 22b545862c01fd360a3221e8505dcd59edf1845f Mon Sep 17 00:00:00 2001 From: Erwan Guyader Date: Fri, 2 Aug 2024 14:54:07 +0200 Subject: [PATCH] ci: Stringify automated registration errors 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. --- dev/remote/automated_registration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/remote/automated_registration.js b/dev/remote/automated_registration.js index a505dc083..ad79402e0 100644 --- a/dev/remote/automated_registration.js +++ b/dev/remote/automated_registration.js @@ -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)}` + ) } }