diff --git a/backend/routes/ErrorRouter.ts b/backend/routes/ErrorRouter.ts index e88547ba..4eea6485 100644 --- a/backend/routes/ErrorRouter.ts +++ b/backend/routes/ErrorRouter.ts @@ -1,6 +1,7 @@ /// 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 + ); } - - - } \ No newline at end of file diff --git a/common/entities/Error.ts b/common/entities/Error.ts index fef54229..99247d9e 100644 --- a/common/entities/Error.ts +++ b/common/entities/Error.ts @@ -9,7 +9,8 @@ export enum ErrorCodes{ USER_CREATION_ERROR, - GENERAL_ERROR + GENERAL_ERROR, + SERVER_ERROR } diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 971f38ee..36409a18 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -9,8 +9,6 @@ import {Directory} from "../../../common/entities/Directory"; @Injectable() export class GalleryService{ - - constructor(private _networkService:NetworkService){ } @@ -18,8 +16,4 @@ export class GalleryService{ return this._networkService.getJson("/gallery/content/"+directoryName); } - - - - }