nestjs-starter
Version:
Get started for beginners with Nestjs
46 lines (40 loc) • 1.32 kB
text/typescript
import { HttpStatus } from '@nestjs/common';
import { IErrorMessages } from './interfaces/error-message.interface';
export const errorMessagesConfig: { [messageCode: string]: IErrorMessages } = {
'user:create:missingInformation': {
type: 'BadRequest',
httpStatus: HttpStatus.BAD_REQUEST,
errorMessage: 'Unable to create a new user with missing information.',
userMessage: 'Unable to create a new user with missing information.',
},
'cors:notAllowed': {
type: 'CORS',
httpStatus: HttpStatus.PAYLOAD_TOO_LARGE,
errorMessage: 'Not allowed by CORS',
userMessage: 'Not allowed by CORS.',
},
'content:key:exists': {
type: 'BadRequest',
httpStatus: HttpStatus.BAD_REQUEST,
errorMessage: 'key exists.',
userMessage: 'key exists.',
},
'content:body:null': {
type: 'BadRequest',
httpStatus: HttpStatus.BAD_REQUEST,
errorMessage: 'not null.',
userMessage: 'not null.',
},
'auth:header:null': {
type: 'Unauthorized',
httpStatus: HttpStatus.UNAUTHORIZED,
errorMessage: 'Unauthorized',
userMessage: 'Unauthorized',
},
'auth:tokenExpired': {
type: 'Unauthorized',
httpStatus: HttpStatus.UNAUTHORIZED,
errorMessage: 'jwt expired',
userMessage: 'jwt expired',
},
};