Browse Source
Return blank JSON objects for 404s, to match registry.npmjs.org
pull/4/head
Wes Mason
9 years ago
No known key found for this signature in database
GPG Key ID: 121DB7952C93970C
1 changed files with
6 additions and
1 deletions
-
app.js
|
|
@ -94,7 +94,12 @@ app.use(function(req, res, next) { |
|
|
|
app.use(function(err, req, res, next) { |
|
|
|
err.stack && console.log( err.stack ); |
|
|
|
res.status(err.status || 500); |
|
|
|
res.send( err.message || err ); |
|
|
|
var message = err.message || err; |
|
|
|
// NPM registry returns empty objects for unknown packages
|
|
|
|
if( err.status == 404 ){ |
|
|
|
message = {}; |
|
|
|
} |
|
|
|
res.send( message ); |
|
|
|
if( next ) { next(); } |
|
|
|
}); |
|
|
|
|
|
|
|