diff --git a/api/src/customError/CustomError.ts b/api/src/customError/CustomError.ts new file mode 100644 index 0000000..f52409d --- /dev/null +++ b/api/src/customError/CustomError.ts @@ -0,0 +1,9 @@ +export class CustomError extends Error { + statusCode: number; + + constructor(message, name, statusCode) { + super(message); + this.name = name; + this.statusCode = statusCode; + } +} diff --git a/api/src/filters/http-exception.filter.ts b/api/src/filters/http-exception.filter.ts new file mode 100644 index 0000000..56a25a3 --- /dev/null +++ b/api/src/filters/http-exception.filter.ts @@ -0,0 +1,26 @@ +import { + ExceptionFilter, + Catch, + ArgumentsHost, + HttpException +} from '@nestjs/common'; +import { Request, Response } from 'express'; + +@Catch(HttpException) +export class HttpExceptionFilter implements ExceptionFilter { + catch(excpetion: HttpException, host: ArgumentsHost) { + const ctx = host.switchToHttp(); + const response = ctx.getResponse(); + const request = ctx.getRequest(); + const status = excpetion.getStatus(); + console.log(excpetion.cause); + + response.status(status).json({ + name: excpetion.cause, + message: excpetion.message, + statusCode: status, + timestamp: new Date().toISOString(), + path: request.url + }); + } +} diff --git a/app/src/components/siteNav/ISiteNavProps.ts b/app/src/components/siteNav/ISiteNavProps.ts new file mode 100644 index 0000000..88a7b43 --- /dev/null +++ b/app/src/components/siteNav/ISiteNavProps.ts @@ -0,0 +1,7 @@ +import { InteractionStatus } from '@azure/msal-browser'; + +export interface ISiteNavProps { + handleSignIn: () => void; + handleSignOut: () => void; + inProgress: InteractionStatus; +}