add auth and user handling
This commit is contained in:
parent
db057ce342
commit
1fce467571
19 changed files with 356 additions and 32 deletions
39
src/errors/httpErrors.ts
Normal file
39
src/errors/httpErrors.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
export class ValidationError extends Error {
|
||||
statusCode = 400;
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "ValidationError";
|
||||
}
|
||||
}
|
||||
|
||||
export class NotFoundError extends Error {
|
||||
statusCode = 404;
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "NotFoundError";
|
||||
}
|
||||
}
|
||||
|
||||
export class ConflictError extends Error {
|
||||
statusCode = 409;
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "ConflictError";
|
||||
}
|
||||
}
|
||||
|
||||
export class InternalServerError extends Error {
|
||||
statusCode = 500;
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "InternalServerError";
|
||||
}
|
||||
}
|
||||
|
||||
export class UnauthorizedError extends Error {
|
||||
statusCode = 409;
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "UnauthorizedError";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue