0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added missing error message handler for the integrity token endpoint (#22043)

ref https://linear.app/ghost/issue/PRO-1349

- the integrity token endpoint can return a json response with an error
message (for example, when rate limited)
- added the standard response handler to the integrity token endpoint in
Portal, to render the error message sent by the backend
This commit is contained in:
Sag 2025-01-22 14:26:49 +07:00 committed by GitHub
parent 3a38aef9b2
commit f07291b72c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;