mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Updated error code for incorrect recipients in GhostMailer
no issue - By default, GhostMailer throws EmailError with statusCode as `500` for any failure in sending mail - In case of failure due to `RecipientError`, status code as now correctly sent as `400` as its a bad request and not an error we can't handle.
This commit is contained in:
parent
6232981be7
commit
e8511d0568
1 changed files with 2 additions and 0 deletions
|
@ -48,9 +48,11 @@ function createMessage(message) {
|
|||
|
||||
function createMailError({message, err, ignoreDefaultMessage} = {message: ''}) {
|
||||
const fullErrorMessage = defaultErrorMessage + message;
|
||||
let statusCode = err.name === 'RecipientError' ? 400 : 500;
|
||||
return new errors.EmailError({
|
||||
message: ignoreDefaultMessage ? message : fullErrorMessage,
|
||||
err: err,
|
||||
statusCode,
|
||||
help: helpMessage
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue