This commit is contained in:
thosakwe 2017-01-20 17:46:12 -05:00
parent e82cbc312c
commit 43309519cd

View file

@ -26,13 +26,14 @@ configureAfter(Angel app) async {
});
errors.fatalErrorHandler = (AngelFatalError e) async {
e.request.response
..statusCode = 500
..writeln('500 Internal Server Error: ${e.error}')
..writeln(e.stack);
await e.request.response.close();
var req = await RequestContext.from(e.request, app);
var res = new ResponseContext(e.request.response, app);
res.render('error', {'message': 'Internal Server Error: ${e.error}'});
await app.sendRequest(e.request, req, res);
};
app.get('/trump', () => throw new Exception('MAGA'));
// Throw a 404 if no route matched the request
app.after.add(errors.throwError());