New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get errorhandler to work in Express 4 #16
Comments
Your error handler should be after the routes. Also var express = require('express');
var errorHandler = require('errorhandler');
var app = express();
app.get('/', function(req, res, next) {
return next(new Error('some error'));
});
app.use(errorHandler());
app.listen(3000); It will also work if an error is thrown like: var express = require('express');
var errorHandler = require('errorhandler');
var app = express();
app.get('/', function(req, res, next) {
throw new Error('some error');
});
app.use(errorHandler());
app.listen(3000); You'll want to review some of the api documentation, specifically: |
Yeah @rahmatawaludin, like @jordonias said, you always wanna |
At a bare minimum there should be a link in README.md to the error-handling guide in the |
True 💯 Are you gonna make that pull request, or shall I? |
You can start one if you'd like. I won't have time until later. |
Yea, me as well, i'll have it in the pull request queue tonight. |
I'm going to close this issue since the question was ultimately answered :) |
I'm new in this. I have this code:
When I hit
/
I thought I should get the errorhandler in styled html, but it just shown like this:What should I do to show the errorhandler html on the response??
The text was updated successfully, but these errors were encountered: