mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-22 22:16:29 +01:00
improve error handling in background jobs #3
This commit is contained in:
parent
6a60e3c10a
commit
04ae271e1e
8 changed files with 75 additions and 27 deletions
33
api/src/errors/http-error.ts
Normal file
33
api/src/errors/http-error.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { HTTPException } from "hono/http-exception";
|
||||
|
||||
// Client errors
|
||||
export class UserInactiveError extends HTTPException{
|
||||
constructor(){
|
||||
super(403, { message: 'User is currently disabled.' })
|
||||
}
|
||||
}
|
||||
|
||||
export class MissingMailError extends HTTPException{
|
||||
constructor(){
|
||||
super(400, { message: 'Mail address is missing in authorizaton header.' })
|
||||
}
|
||||
}
|
||||
|
||||
export class MissingParameter extends HTTPException{
|
||||
constructor(paramName: string){
|
||||
super(400, { message: `Request parameter '${paramName}' missing` })
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidParameter extends HTTPException{
|
||||
constructor(paramName: string){
|
||||
super(400, { message: `Provided parameter '${paramName}' is invalid.` })
|
||||
}
|
||||
}
|
||||
|
||||
// Server side errors
|
||||
export class DatabaseError extends HTTPException{
|
||||
constructor(){
|
||||
super(500, { message: 'Internal Database Error' })
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue