ErrorUnit

libflitter/errors/ErrorUnit~ ErrorUnit

The error unit defines last-resort handlers for HTTP 404 and HTTP 500 errors. This unit must be loaded after all other routes. If it isn't, it will preempt any other routes from working. The routes in this unit are used if no other path is found. The handler alters the status of the request to the HTTP error, then renders the appropriate view in the "views/errors/" directory.

Constructor

new ErrorUnit()

Source:

Extends

Methods

(async) cleanup(app) → {Promise.<void>}

Source:
Inherited From:

Cleans up the unit's resources before Flitter closes.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

directories() → {Object}

Source:
Inherited From:

Get the directories provided by the unit. Should be an object such that key => value is the name of the directory => fully qualified path to the directory.

Returns:
Type
Object

(async) go(app) → {Promise.<void>}

Source:
Overrides:

Loads the unit. Registers last-resort handlers for HTTP404 and HTTP500 errors with the underlying Express app. All HTTP errors are handled by rendering the view where the canonical name is 'errors:CODE' where 'CODE' is the numerical error code. If the 'server.environment' configuration is set to development, then all errors are handled by rendering the 'errors:development' view.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

name() → {string}

Source:
Overrides:

Get the name of the unit.

Returns:

"error_handling"

Type
string