add forwarder error intance

This commit is contained in:
rafiarrafif
2025-05-27 02:47:29 +07:00
parent ee8e8d08db
commit a7c984b316
8 changed files with 51 additions and 18 deletions

View File

@ -0,0 +1,13 @@
import { AppError } from "./app";
export function ErrorForwarder(
statusCode: number,
message: string,
cause: unknown
): never {
if (cause instanceof AppError) {
throw cause;
}
throw new AppError(statusCode, message, cause);
}