You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-05 23:18:43 +02:00
improving error handling
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
///<reference path="../../typings/main.d.ts"/>
|
||||
|
||||
import {RenderingMWs} from "../middlewares/RenderingMWs";
|
||||
import {Error, ErrorCodes} from "../../common/entities/Error";
|
||||
|
||||
export class ErrorRouter{
|
||||
constructor(private app) {
|
||||
@@ -17,15 +18,13 @@ export class ErrorRouter{
|
||||
|
||||
private addGenericHandler() {
|
||||
this.app.use((err, req, res, next) => {
|
||||
res.status(500).send('Houston, we have a problem!');
|
||||
|
||||
//Flush out the stack to the console
|
||||
console.error(err.stack);
|
||||
});
|
||||
|
||||
next(new Error(ErrorCodes.SERVER_ERROR,"Unknown server side error"));
|
||||
},
|
||||
RenderingMWs.renderError
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user