Browse Source

Log only once per error.

middleware/500.js
	-Make one log call per error rather than two, to reduce
	clutter/noise.
pull/123/head
Severyn Kozak 10 years ago
parent
commit
0b8220cbf3
  1. 3
      middleware/500.js

3
middleware/500.js

@ -2,8 +2,7 @@ var logger = require( 'pelias-logger' ).get( 'middleware-500' );
// handle application errors
function middleware(err, req, res, next) {
logger.error( err );
logger.error( 'Stack trace:', err.trace );
logger.error( 'Error: `%s`. Stack trace: `%s`.', err, err.stack );
res.header('Cache-Control','no-cache');
if( res.statusCode < 400 ){ res.status(500); }
res.json({ error: typeof err === 'string' ? err : 'internal server error' });

Loading…
Cancel
Save