Initial Commit

This commit is contained in:
Dries Augustyns
2024-07-23 13:49:48 +02:00
commit 91a8840c3c
191 changed files with 36022 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
export class HttpException extends Error {
public constructor(
public readonly code: number,
message: string,
) {
super(message);
}
}
export class NotFound extends HttpException {
/**
* Construct a new NotFound exception
* @param resource The type of resource that was not found
*/
public constructor(resource: string) {
super(404, `That ${resource.toLowerCase()} was not found`);
}
}
export class NotAllowed extends HttpException {
/**
* Construct a new NotAllowed exception
* @param msg
*/
public constructor(msg = 'You are not allowed to perform this action') {
super(403, msg);
}
}
export class NotAuthenticated extends HttpException {
public constructor() {
super(401, 'You need to be authenticated to do this');
}
}