mirror of
https://github.com/harish2704/npm-offline-registry.git
synced 2026-09-10 06:21:09 +00:00
Merge remote-tracking branch '1stvamp/empty-object-on-404' into 1stvamp-empty-object-on-404
This commit is contained in:
@@ -94,7 +94,12 @@ app.use(function(req, res, next) {
|
|||||||
app.use(function(err, req, res, next) {
|
app.use(function(err, req, res, next) {
|
||||||
err.stack && console.log( err.stack );
|
err.stack && console.log( err.stack );
|
||||||
res.status(err.status || 500);
|
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(); }
|
if( next ) { next(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user