Bam
This commit is contained in:
parent
e82cbc312c
commit
43309519cd
1 changed files with 7 additions and 6 deletions
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in a new issue