Fixed most errors in middleware

This commit is contained in:
SamTV12345 2024-08-19 22:35:49 +02:00
parent 43c0cdfd1e
commit 7db8b54476
9 changed files with 138 additions and 173 deletions

View file

@ -8,11 +8,12 @@ const stats = require('../../stats')
exports.expressCreateServer = (hook_name:string, args: ArgsExpressType, cb:Function) => {
// Handle errors
args.app.set_error_handler((req, res, error)=>{
console.log('Error: ', error);
// if an error occurs Connect will pass it down
// through these "error-handling" middleware
// allowing you to respond however you like
res.status(500).json({error: 'Sorry, something bad happened!'});
console.error(error.stack ? error.stack : error.toString());
//res.status(500).json({error: 'Sorry, something bad happened!'});
stats.meter('http500').mark();
})