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:
parent
3a38aef9b2
commit
f07291b72c
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue