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
This commit is contained in:
Thomas Camlong
2025-11-07 08:10:51 +01:00
parent 1cc433b6bf
commit 43a63b5aa7

12
web/src/lib/errors.ts Normal file
View File

@@ -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
}
}