diff --git a/apps/portal/src/utils/api.js b/apps/portal/src/utils/api.js index aabea5aa7a89..55bd0a8536ad 100644 --- a/apps/portal/src/utils/api.js +++ b/apps/portal/src/utils/api.js @@ -254,6 +254,10 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) { if (res.ok) { return res.text(); } else { + const humanError = await HumanReadableError.fromApiResponse(res); + if (humanError) { + throw humanError; + } throw new Error('Failed to start a members session'); } }, @@ -290,7 +294,6 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) { if (res.ok) { return 'Success'; } else { - // Try to read body error message that is human readable and should be shown to the user const humanError = await HumanReadableError.fromApiResponse(res); if (humanError) { throw humanError;