26 lines
767 B
TypeScript
26 lines
767 B
TypeScript
import app from '@adonisjs/core/services/app'
|
|
import { HttpContext, ExceptionHandler } from '@adonisjs/core/http'
|
|
import type { StatusPageRange, StatusPageRenderer } from '@adonisjs/core/types/http'
|
|
|
|
export default class HttpExceptionHandler extends ExceptionHandler {
|
|
/**
|
|
* In debug mode, the exception handler returns detailed errors.
|
|
*/
|
|
protected debug = !app.inProduction
|
|
|
|
/**
|
|
* Render validation/known errors as JSON for an API-only backend.
|
|
*/
|
|
protected renderStatusPages = false
|
|
|
|
protected statusPages: Record<StatusPageRange, StatusPageRenderer> = {}
|
|
|
|
async handle(error: unknown, ctx: HttpContext) {
|
|
return super.handle(error, ctx)
|
|
}
|
|
|
|
async report(error: unknown, ctx: HttpContext) {
|
|
return super.report(error, ctx)
|
|
}
|
|
}
|