refactor(backend): File has too many classes
This commit is contained in:
parent
25f9eb2af2
commit
5b31cec5fe
15 changed files with 87 additions and 67 deletions
11
backend/src/exceptions/badRequestException.ts
Normal file
11
backend/src/exceptions/badRequestException.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { HttpException } from './httpException.js';
|
||||
|
||||
/**
|
||||
* Exception for HTTP 400 Bad Request
|
||||
*/
|
||||
|
||||
export class BadRequestException extends HttpException {
|
||||
constructor(message: string = 'Bad Request') {
|
||||
super(400, message);
|
||||
}
|
||||
}
|
10
backend/src/exceptions/forbiddenException.ts
Normal file
10
backend/src/exceptions/forbiddenException.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { HttpException } from './httpException.js';
|
||||
|
||||
/**
|
||||
* Exception for HTTP 403 Forbidden
|
||||
*/
|
||||
export class ForbiddenException extends HttpException {
|
||||
constructor(message: string = 'Forbidden') {
|
||||
super(403, message);
|
||||
}
|
||||
}
|
8
backend/src/exceptions/httpException.ts
Normal file
8
backend/src/exceptions/httpException.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export class HttpException extends Error {
|
||||
constructor(
|
||||
public status: number,
|
||||
message: string
|
||||
) {
|
||||
super(message);
|
||||
}
|
||||
}
|
10
backend/src/exceptions/notFoundException.ts
Normal file
10
backend/src/exceptions/notFoundException.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { HttpException } from './httpException.js';
|
||||
|
||||
/**
|
||||
* Exception for HTTP 404 Not Found
|
||||
*/
|
||||
export class NotFoundException extends HttpException {
|
||||
constructor(message: string = 'Not Found') {
|
||||
super(404, message);
|
||||
}
|
||||
}
|
10
backend/src/exceptions/unauthorizedException.ts
Normal file
10
backend/src/exceptions/unauthorizedException.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { HttpException } from './httpException.js';
|
||||
|
||||
/**
|
||||
* Exception for HTTP 401 Unauthorized
|
||||
*/
|
||||
export class UnauthorizedException extends HttpException {
|
||||
constructor(message: string = 'Unauthorized') {
|
||||
super(401, message);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue