init project evolution api

This commit is contained in:
Davidson Gomes
2023-06-09 07:48:59 -03:00
commit 2a1c426311
90 changed files with 9820 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { HttpStatus } from '../whatsapp/routers/index.router';
export class BadRequestException {
constructor(...objectError: any[]) {
throw {
status: HttpStatus.BAD_REQUEST,
error: 'Bad Request',
message: objectError.length > 0 ? objectError : undefined,
};
}
}

View File

@@ -0,0 +1,11 @@
import { HttpStatus } from '../whatsapp/routers/index.router';
export class UnauthorizedException {
constructor(...objectError: any[]) {
throw {
status: HttpStatus.UNAUTHORIZED,
error: 'Unauthorized',
message: objectError.length > 0 ? objectError : undefined,
};
}
}

View File

@@ -0,0 +1,11 @@
import { HttpStatus } from '../whatsapp/routers/index.router';
export class ForbiddenException {
constructor(...objectError: any[]) {
throw {
status: HttpStatus.FORBIDDEN,
error: 'Forbidden',
message: objectError.length > 0 ? objectError : undefined,
};
}
}

View File

@@ -0,0 +1,11 @@
import { HttpStatus } from '../whatsapp/routers/index.router';
export class NotFoundException {
constructor(...objectError: any[]) {
throw {
status: HttpStatus.NOT_FOUND,
error: 'Not Found',
message: objectError.length > 0 ? objectError : undefined,
};
}
}

View File

@@ -0,0 +1,11 @@
import { HttpStatus } from '../whatsapp/routers/index.router';
export class InternalServerErrorException {
constructor(...objectError: any[]) {
throw {
status: HttpStatus.INTERNAL_SERVER_ERROR,
error: 'Internal Server Error',
message: objectError.length > 0 ? objectError : undefined,
};
}
}

5
src/exceptions/index.ts Normal file
View File

@@ -0,0 +1,5 @@
export * from './400.exception';
export * from './401.exception';
export * from './403.exception';
export * from './404.exception';
export * from './500.exception';