Updated magic link email to use custom status code for failures

refs https://github.com/TryGhost/Team/issues/342

- Send magic link middleware was not using custom status code from error and sending 500
- Updates error code to be picked from err object if present, or fallback to 500 as before otherwise
This commit is contained in:
Rish 2020-07-22 16:06:58 +05:30
parent 763153d110
commit f792148ce8

View File

@ -225,8 +225,9 @@ module.exports = function MembersApi({
res.writeHead(201);
return res.end('Created.');
} catch (err) {
const statusCode = (err && err.statusCode) || 500;
common.logging.error(err);
res.writeHead(500);
res.writeHead(statusCode);
return res.end('Internal Server Error.');
}
});