mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
init project evolution api
This commit is contained in:
11
src/exceptions/400.exception.ts
Normal file
11
src/exceptions/400.exception.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
11
src/exceptions/401.exception.ts
Normal file
11
src/exceptions/401.exception.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
11
src/exceptions/403.exception.ts
Normal file
11
src/exceptions/403.exception.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
11
src/exceptions/404.exception.ts
Normal file
11
src/exceptions/404.exception.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
11
src/exceptions/500.exception.ts
Normal file
11
src/exceptions/500.exception.ts
Normal 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
5
src/exceptions/index.ts
Normal 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';
|
||||
Reference in New Issue
Block a user