mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 23:25:51 +00:00
feat: changed backend-pg to backend
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
export class DatabaseError extends Error {
|
||||
name: string;
|
||||
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, message }: { message?: string; name?: string; error: unknown }) {
|
||||
super(message || "Failed to execute db ops");
|
||||
this.name = name || "DatabaseError";
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
export class InternalServerError extends Error {
|
||||
name: string;
|
||||
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, message }: { message?: string; name?: string; error?: unknown }) {
|
||||
super(message || "Something went wrong");
|
||||
this.name = name || "InternalServerError";
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
export class UnauthorizedError extends Error {
|
||||
name: string;
|
||||
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, message }: { message?: string; name?: string; error?: unknown } = {}) {
|
||||
super(message ?? "You are not allowed to access this resource");
|
||||
this.name = name || "UnauthorizedError";
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
export class ForbiddenRequestError extends Error {
|
||||
name: string;
|
||||
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, message }: { message?: string; name?: string; error?: unknown }) {
|
||||
super(message ?? "You are not allowed to access this resource");
|
||||
this.name = name || "ForbideenError";
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
export class BadRequestError extends Error {
|
||||
name: string;
|
||||
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, message }: { message?: string; name?: string; error?: unknown }) {
|
||||
super(message ?? "The request is invalid");
|
||||
this.name = name || "BadRequest";
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user