@absolunet/ioc2.1.0

View on GitHub

Handler

Main exception handler.

Extends

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app'].

hadException :boolean

Source:
Check if it has already handle an exception during the given request.

lastException :Error|string

Source:
Last exception accessor.

Methods

(async) handle(exception, requestopt, responseopt)

Source:
Handle the given exception.
Parameters:
Name Type Attributes Description
exception Error | string The handled exception.
request request <optional>
The current HTTP request.
response response <optional>
The current HTTP response.
Returns:
The async process promise.
Type
Promise

(async) report(exception)

Source:
Report an exception.
Parameters:
Name Type Description
exception Error | string The exception to report.
Returns:
The async process promise.
Type
Promise

(async) render(exception, requestopt, responseopt)

Source:
Render an exception.
Parameters:
Name Type Attributes Description
exception Error | string The handled exception.
request request <optional>
The current HTTP request.
response response <optional>
The current HTTP response.
Returns:
The async process promise.
Type
Promise

(async) renderResponse(exception, requestopt, responseopt)

Source:
Render an exception as an HTTP response.
Parameters:
Name Type Attributes Description
exception Error | string The handled exception.
request request <optional>
The current HTTP request.
response response <optional>
The current HTTP response.
Returns:
The async process promise.
Type
Promise

(async) renderConsole(exception)

Source:
Render exception in console.
Parameters:
Name Type Description
exception Error | string The handled exception.
Returns:
The async process promise.
Type
Promise

(async) handleReportException(exception)

Source:
Handle a report exception.
Parameters:
Name Type Description
exception Error | string The reported exception.
Returns:
The async process promise.
Type
Promise

driver(nameopt, parametersopt)

Source:
Inherited From:
Get loader driver by name.
Parameters:
Name Type Attributes Default Description
name string <optional>
"default" The driver name.
parameters object <optional>
{} The additional parameters to inject into the driver instance.
Returns:
The resolved driver instance.
Type
object

bootDriver(driver, name)

Source:
Inherited From:
Boot newly created driver.
Parameters:
Name Type Description
driver * The driver instance.
name string The driver name.
Returns:
The driver instance.
Type
*

addDriver(name, driver)

Source:
Inherited From:
Add a driver and bind it with the given name.
Parameters:
Name Type Description
name string The driver name.
driver function The driver class or factory.

setDefaultDriver(name)

Source:
Inherited From:
Set given driver name as the default driver.
Parameters:
Name Type Description
name string The driver name.

setDriverAlias(name, alias)

Source:
Inherited From:
Give driver an alias name.
Parameters:
Name Type Description
name string The driver name.
alias string The driver alias.

hasDriver(name)

Source:
Inherited From:
Check if driver exists.
Parameters:
Name Type Description
name string The driver name.
Returns:
Indicates that the driver exists.
Type
boolean

isDriverAlias(name)

Source:
Inherited From:
Check if given driver name is an alias.
Parameters:
Name Type Description
name string The driver alias name.
Returns:
Indicates that the alias exists.
Type
boolean