first commit

This commit is contained in:
Rutra committed 2026-10-12 14:25:22 +02:00
commit 3c0479faf0
169 files changed
+27617

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { Exception } from '@adonisjs/core/exceptions'
import type { HttpContext } from '@adonisjs/core/http'
/**
* An error whose message is meant for the user (shown as is in the
* dashboard). Defaults to a 400 status.
*/
export default class UserError extends Exception {
static status = 400
constructor(message: string, status?: number) {
super(message, { status: status ?? UserError.status })
}
async handle(error: this, ctx: HttpContext) {
ctx.response.status(error.status).send({ message: error.message })
}
}