1
0
Fork 0

more verbose action debugging

This commit is contained in:
Jan Steemann 2012-10-24 12:04:15 +02:00
parent c226af8e0b
commit 2360cb1cee
2 changed files with 12 additions and 1 deletions

View File

@ -84,7 +84,17 @@ function Routing (req, res) {
req.urlParameters = {};
}
action.route.callback.controller(req, res, action.route.callback.options, next);
var func = action.route.callback.controller;
if (func === null || typeof func !== 'function') {
func = actions.errorFunction(action.route, 'Invalid callback definition found for route ' + JSON.stringify(action.route));
}
try {
func(req, res, action.route.callback.options, next);
}
catch (err) {
actions.errorFunction(action.route, 'A runtime error occurred while executing an action: ' + String(err))(req, res, action.route.callback.options, next);
}
}
next = function () {

View File

@ -1445,6 +1445,7 @@ function redirectRequest (req, res, options, next) {
exports.defineHttp = defineHttp;
exports.getErrorMessage = getErrorMessage;
exports.getJsonBody = getJsonBody;
exports.errorFunction = errorFunction;
exports.reloadRouting = reloadRouting;
exports.firstRouting = firstRouting;
exports.nextRouting = nextRouting;