stats: Move `http500` metric middleware to the beginning
parent
f08a443497
commit
1434129a7b
|
@ -112,6 +112,13 @@ exports.restartServer = async () => {
|
|||
exports.server = http.createServer(app);
|
||||
}
|
||||
|
||||
// This error-handling middleware is installed first to ensure that no other middleware can
|
||||
// prevent the stats from being updated.
|
||||
app.use((err, req, res, next) => {
|
||||
stats.meter('http500').mark();
|
||||
next(err);
|
||||
});
|
||||
|
||||
app.use((req, res, next) => {
|
||||
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
||||
if (settings.ssl) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const stats = require('../../stats');
|
||||
|
||||
exports.expressCreateServer = (hook_name, args, cb) => {
|
||||
exports.app = args.app;
|
||||
|
||||
|
@ -12,7 +10,6 @@ exports.expressCreateServer = (hook_name, args, cb) => {
|
|||
// allowing you to respond however you like
|
||||
res.status(500).send({error: 'Sorry, something bad happened!'});
|
||||
console.error(err.stack ? err.stack : err.toString());
|
||||
stats.meter('http500').mark();
|
||||
});
|
||||
|
||||
return cb();
|
||||
|
|
Loading…
Reference in New Issue