mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-11-18 17:47:30 +01:00
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:
12
web/src/lib/errors.ts
Normal file
12
web/src/lib/errors.ts
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user