Feature/4 pilots add #20
9
api/src/customError/CustomError.ts
Normal file
9
api/src/customError/CustomError.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export class CustomError extends Error {
|
||||||
|
statusCode: number;
|
||||||
|
|
||||||
|
constructor(message, name, statusCode) {
|
||||||
|
super(message);
|
||||||
|
this.name = name;
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
api/src/filters/http-exception.filter.ts
Normal file
26
api/src/filters/http-exception.filter.ts
Normal file
@@ -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<Response>();
|
||||||
|
const request = ctx.getRequest<Request>();
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
7
app/src/components/siteNav/ISiteNavProps.ts
Normal file
7
app/src/components/siteNav/ISiteNavProps.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { InteractionStatus } from '@azure/msal-browser';
|
||||||
|
|
||||||
|
export interface ISiteNavProps {
|
||||||
|
handleSignIn: () => void;
|
||||||
|
handleSignOut: () => void;
|
||||||
|
inProgress: InteractionStatus;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user