public commit

This commit is contained in:
dswbx
2024-11-16 12:01:47 +01:00
commit 90f80c4280
582 changed files with 49291 additions and 0 deletions

37
app/src/core/errors.ts Normal file
View File

@@ -0,0 +1,37 @@
export class Exception extends Error {
code = 400;
override name = "Exception";
constructor(message: string, code?: number) {
super(message);
if (code) {
this.code = code;
}
}
toJSON() {
return {
error: this.message,
type: this.name
//message: this.message
};
}
}
export class BkndError extends Error {
constructor(
message: string,
public details?: Record<string, any>,
public type?: string
) {
super(message);
}
toJSON() {
return {
type: this.type ?? "unknown",
message: this.message,
details: this.details
};
}
}