RingoJS

Module middleware/error

Middleware to catch errors and generate simple error pages.

By default, resource stick/middleware/error.html is used as page template. This can be set through the app.error.template property. This is the complete list of properties that influence the behaviour of this middleware:

  • template the error page template (string)
  • message static error message to use instead of actual message (string)
  • location whether to report any information about the code location of the error (boolean)
  • stack whether to include a JavaScript stack trace (boolean)
  • javaStack whether to include a Java stack trace (boolean)

Example

app.configure("error");
app.error.template = module.resolve("500.html");
app.error.location = true;

Functions


middleware (next, app)

Stick middleware factory to display error messages and stack traces.

Parameters

Function next

the wrapped middleware chain

Object app

the Stick Application object

Returns

Function

a JSGI middleware function