mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Override "Forbidden" Mailgun error to be more useful
no issue - a 401 is received from Mailgun when invalid credentials are used but the default error message of "Forbidden" is not particularly useful - intercepts "Forbidden" and swaps it for "Invalid Mailgun credentials" to be more user-friendly
This commit is contained in:
parent
e82f706afa
commit
f6ef12847a
1 changed files with 6 additions and 0 deletions
|
@ -22,6 +22,12 @@ class SuccessfulBatch extends BatchResultBase {
|
|||
class FailedBatch extends BatchResultBase {
|
||||
constructor(error, data) {
|
||||
super();
|
||||
|
||||
// give a better error message for the invalid credentials state
|
||||
if (error.message === 'Forbidden') {
|
||||
error.message = 'Invalid Mailgun credentials';
|
||||
}
|
||||
|
||||
this.error = error;
|
||||
this.data = data;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue