mirror of
https://github.com/detleph/server.git
synced 2026-09-05 07:56:21 +02:00
Add function to create disciplines
+ Fix async errors + Extract name error
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export default class ForwardableError extends Error {
|
||||
// If in different context
|
||||
private readonly __id = "CUSTOM_ERROR";
|
||||
protected readonly __oid?: string;
|
||||
|
||||
public readonly status: number;
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import ForwardableError from "./ForwardableError";
|
||||
|
||||
export default class NotFoundError extends ForwardableError {
|
||||
protected __oid = "NOT_FOUND_ERROR";
|
||||
|
||||
constructor(resource?: string, pid?: string) {
|
||||
super(404, `The requested ${resource ?? "resource"}${pid ? ` with PID '${pid}'` : ""} could not be found!`);
|
||||
}
|
||||
|
||||
static isNotFoundError(err: any): err is NotFoundError {
|
||||
return err.__oid === "NOT_FOUND_ERROR";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user