mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Pass all error properties to message generator
This commit is contained in:
@@ -473,6 +473,7 @@ app.use(async (err, req, res, next)=>{
|
||||
description : 'Something went wrong!'
|
||||
};
|
||||
req.brew = {
|
||||
...err,
|
||||
title : 'Error - Something went wrong!',
|
||||
text : err.errors?.map((error)=>{return error.message;}).join('\n\n') || err.message || 'Unknown error!',
|
||||
status : status,
|
||||
|
||||
@@ -68,7 +68,7 @@ const api = {
|
||||
const isAuthor = stub?.authors?.includes(req.account?.username);
|
||||
const isInvited = stub?.invitedAuthors?.includes(req.account?.username);
|
||||
if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) {
|
||||
throw { name: 'Access Error', message: 'User is not an Author', status: 401, HBErrorCode: '03' };
|
||||
throw { name: 'Access Error', message: 'User is not an Author', status: 401, HBErrorCode: '03', authors: stub.authors };
|
||||
}
|
||||
|
||||
// If after all of that we still don't have a brew, throw an exception
|
||||
|
||||
Reference in New Issue
Block a user