refactor(backend): File has too many classes

This commit is contained in:
Tibo De Peuter 2025-03-23 11:31:48 +01:00
parent 25f9eb2af2
commit 5b31cec5fe
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
15 changed files with 87 additions and 67 deletions

View 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);
}
}

View 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);
}
}

View file

@ -0,0 +1,8 @@
export class HttpException extends Error {
constructor(
public status: number,
message: string
) {
super(message);
}
}

View 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);
}
}

View 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);
}
}