mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
feat: add api controllers and routes for browser extension
This commit is contained in:
@@ -36,6 +36,13 @@ export default class HttpExceptionHandler extends ExceptionHandler {
|
||||
* response to the client
|
||||
*/
|
||||
async handle(error: unknown, ctx: HttpContext) {
|
||||
if (ctx.request.url()?.startsWith('/api/v1')) {
|
||||
return ctx.response.status(400).json({
|
||||
message: 'Bad Request',
|
||||
errors: [error],
|
||||
});
|
||||
}
|
||||
|
||||
if (error instanceof errors.E_ROW_NOT_FOUND) {
|
||||
return ctx.response.redirectToNamedRoute('dashboard');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user