This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/api/app/exceptions/handler.ts

37 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-08-09 23:51:41 +02:00
import type { HttpContext } from "@adonisjs/core/http"
import { ExceptionHandler } from "@adonisjs/core/http"
import app from "@adonisjs/core/services/app"
2024-08-18 02:31:02 +02:00
export interface ExceptionMessage {
message: string
}
2024-08-09 23:51:41 +02:00
export default class HttpExceptionHandler extends ExceptionHandler {
/**
* In debug mode, the exception handler will display verbose errors with pretty printed stack traces.
*/
protected override debug = !app.inProduction
/**
* The method is used for handling errors and returning response to the client.
*/
public override async handle(
error: unknown,
context: HttpContext,
2024-08-09 23:51:41 +02:00
): Promise<unknown> {
return await super.handle(error, context)
2024-08-09 23:51:41 +02:00
}
/**
* The method is used to report error to the logging service or the third party error monitoring service.
*
* @note You should not attempt to send a response from this method.
*/
public override async report(
error: unknown,
context: HttpContext,
2024-08-09 23:51:41 +02:00
): Promise<void> {
return await super.report(error, context)
2024-08-09 23:51:41 +02:00
}
}