mirror of https://github.com/pelias/api.git
Harish Krishna
10 years ago
2 changed files with 10 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||||
|
|
||||||
|
// handle time out errors
|
||||||
|
function middleware(err, req, res, next) { |
||||||
|
res.header('Cache-Control','no-cache'); |
||||||
|
if( res.statusCode === 408 ){ res.status(408); } |
||||||
|
res.json({ error: typeof err === 'string' ? err : 'request time out' }); |
||||||
|
} |
||||||
|
|
||||||
|
module.exports = middleware; |
Loading…
Reference in new issue