공통 패키징 작업
This commit is contained in:
@@ -1,2 +1,6 @@
|
||||
yarnPath: .yarn/releases/yarn-4.11.0.cjs
|
||||
npmScopes:
|
||||
baekyangdan:
|
||||
npmRegistryServer: "https://gitea.bkdhome.p-e.kr/api/packages/baekyangdan/npm/"
|
||||
npmAuthToken: "d39c7d88c52806df7522ce2b340b6577c5ec5082"
|
||||
nodeLinker: node-modules
|
||||
@@ -26,6 +26,7 @@
|
||||
"drizzle-pull:prod": "dotenv -e .env.prod -- drizzle-kit pull"
|
||||
},
|
||||
"dependencies": {
|
||||
"@baekyangdan/core-utils": "^1.0.4",
|
||||
"@fastify/cookie": "^11.0.2",
|
||||
"@nestjs/class-transformer": "^0.4.0",
|
||||
"@nestjs/class-validator": "^0.13.4",
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { JsonWebTokenError, TokenExpiredError } from '@nestjs/jwt';
|
||||
import { FastifyReply, FastifyRequest } from 'fastify';
|
||||
import { UnauthorizedCode, UnauthorizedMessage, BadRequestCode, BadRequestMessage, InternalServerErrorCode, InternalServerErrorMessage } from '@baekyangdan/core-utils';
|
||||
|
||||
@Catch()
|
||||
export class AllExceptionsFilter implements ExceptionFilter {
|
||||
@@ -22,8 +23,8 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
||||
|
||||
const responseBody = {
|
||||
statusCode: status,
|
||||
message: 'Access Token Expired',
|
||||
code: 'AccessTokenExpired',
|
||||
message: UnauthorizedMessage.ACCESS_TOKEN_EXPIRED,
|
||||
code: UnauthorizedCode.ACCESS_TOKEN_EXPIRED,
|
||||
timestamp: new Date().toISOString(),
|
||||
path: ctx.getRequest().url
|
||||
};
|
||||
@@ -38,8 +39,8 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
||||
|
||||
const responseBody = {
|
||||
statusCode: status,
|
||||
message: 'Invalid Token',
|
||||
code: 'InvalidToken',
|
||||
message: UnauthorizedMessage.INVALID_TOKEN,
|
||||
code: UnauthorizedCode.INVALID_TOKEN,
|
||||
timestamp: new Date().toISOString(),
|
||||
path: ctx.getRequest().url
|
||||
};
|
||||
@@ -56,7 +57,7 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
||||
let message =
|
||||
exception instanceof HttpException
|
||||
? exception.getResponse()
|
||||
: 'Internal server error';
|
||||
: InternalServerErrorMessage.INTERNAL_SERVER_ERROR;
|
||||
|
||||
if (typeof message === 'object' && (message as any).message) {
|
||||
message = (message as any).message;
|
||||
@@ -67,7 +68,8 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
||||
timestamp: new Date().toISOString(),
|
||||
path: request.url,
|
||||
statusCode: status,
|
||||
error: message
|
||||
message: message,
|
||||
error: InternalServerErrorCode
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user