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