improve error handling in background jobs #3

This commit is contained in:
Michi 2025-10-11 11:56:17 +02:00
parent 6a60e3c10a
commit 04ae271e1e
8 changed files with 75 additions and 27 deletions

View 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' })
}
}