Fix build and implement user/all correctly

This commit is contained in:
araemer 2025-11-18 20:26:28 +01:00
parent a9bd803112
commit 555dacfaf5
17 changed files with 170 additions and 48 deletions

View file

@ -1,3 +1,5 @@
import {HttpStatusCode} from "../apiHelpers/HttpStatusCodes.js";
/**
* Base class for all HTTP-related errors.
* Extends the built-in Error with a status code and message
@ -17,19 +19,25 @@ export class HttpError extends Error {
export class ValidationError extends HttpError {
constructor(message: string) {
super(message, 400); // Bad Request
super(message, HttpStatusCode.BAD_REQUEST); // Bad Request
}
}
export class UnauthorizedError extends HttpError {
constructor(message: string = "Unauthorized") {
super(message, 401);
super(message, HttpStatusCode.UNAUTHORIZED);
}
}
export class ForbiddenError extends HttpError {
constructor(message: string = "Forbidden") {
super(message, HttpStatusCode.FORBIDDEN);
}
}
export class NotFoundError extends HttpError {
constructor(message: string = "Resource not found") {
super(message, 404);
super(message, HttpStatusCode.NOT_FOUND);
}
}