mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
removed use of app.error() in examples
This commit is contained in:
parent
456a985666
commit
297ae6fdb4
|
|
@ -38,7 +38,7 @@ app.get('/files/:file(*)', function(req, res, next){
|
|||
});
|
||||
});
|
||||
|
||||
app.error(function(err, req, res, next){
|
||||
app.use(function(err, req, res, next){
|
||||
if ('ENOENT' == err.code) {
|
||||
res.send('Cant find that file, sorry!');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ function bootApplication(app) {
|
|||
app.use(express.static(__dirname + '/public'));
|
||||
|
||||
// Example 500 page
|
||||
app.error(function(err, req, res){
|
||||
console.dir(err)
|
||||
app.use(function(err, req, res, next){
|
||||
res.render('500');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function andRestrictToSelf(req, res, next) {
|
|||
} else {
|
||||
// You may want to implement specific exceptions
|
||||
// such as UnauthorizedError or similar so that you
|
||||
// can handle these in app.error() specifically
|
||||
// can handle these can be special-cased in an error handler
|
||||
// (view ./examples/pages for this)
|
||||
next(new Error('Unauthorized'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user