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 {
|
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());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue