ErrorHandler

RobeeeJay edited this page Aug 23, 2012 · 1 revision

This module catches any errors related to this request.

new fw.ErrorHandler({ onError: func, showError: true, stackTrace: true });

All arguments are optional.

onError points to a function that takes the following arguments (error, handler, request, response), where error is the error object, and handler is the ErrorHandler object. A default is provided.

For the default error function, showError enables if the thrown error should be displayed to the client, and stackTrace enables. Both are false by default, and a generic 500 error will be shown instead.

Simple Example

var stackFull = new fw.Stack();

stackFull.append(new fw.ErrorHandler());

The above will catch all errors and display the standard error page without any error information beyond the fact one has occured.