From 43a63b5aa7660cad872342c0b54a62f3a000e718 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 7 Nov 2025 08:10:51 +0100 Subject: [PATCH] feat(api): add custom ApiError class for error handling - Create ApiError class extending Error with status code support - Enables better error handling and status code management in API calls --- web/src/lib/errors.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 web/src/lib/errors.ts diff --git a/web/src/lib/errors.ts b/web/src/lib/errors.ts new file mode 100644 index 00000000..e1f6eceb --- /dev/null +++ b/web/src/lib/errors.ts @@ -0,0 +1,12 @@ +/** + * Custom error class for API errors + */ +export class ApiError extends Error { + status: number + + constructor(message: string, status = 500) { + super(message) + this.name = "ApiError" + this.status = status + } +}