adonisjs / http-server

AdonisJS HTTP Server along with its Router
https://docs.adonisjs.com/guides/http
MIT License
113 stars 31 forks source link

Handler Custom 404 page error #22

Closed NikooDev closed 4 years ago

NikooDev commented 4 years ago

Package version

Adonisjs 5 @adonisjs/core@^5.0.0-preview-rc @adonisjs/http-server@^3.0.1

Node.js and npm version

Node.js: v14.8.0 npm: v6.14.7

Sample Code (to reproduce the issue)

Exceptions/Handler.ts

import Logger from '@ioc:Adonis/Core/Logger'
import HttpExceptionHandler from '@ioc:Adonis/Core/HttpExceptionHandler'

export default class ExceptionHandler extends HttpExceptionHandler {

        protected disableStatusPagesInDevelopment = false
    protected statusPages = {
        '404': 'errors.not-found',
        '500..599': 'errors.server-error',
    }

    constructor () {
        super(Logger)
    }
}

Server errors correctly display the custom error page. 404 errors only display an error message:

E_ROUTE_NOT_FOUND: Cannot GET: /test

thetutlage commented 4 years ago

Will pick up during the weekend