Permalink
Browse files

All results returned by a remapped route are now of type RouteResult.

  • Loading branch information...
1 parent 23b54fa commit 9640ab30a870bdf8402fda15c84dc586045cafcf @thatismatt committed Jun 12, 2010
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/josi/routing.js
View
@@ -31,7 +31,7 @@ this.FunctionRouter = FunctionRouter = Class.extend({
if (mappingResult instanceof routeresults.RouteResult) {
return mappingResult;
} else {
- return new routeresults.RouteResult(mappingResult.action, mappingResult.context);
+ throw new Error('Remapped route from router.route must return an instance of RouteResult');
}
} else {
return new routeresults.RouteResult(route.action, context);
@@ -72,10 +72,7 @@ this.ControllerRouter = ControllerRouter = FunctionRouter.extend({
context = context.slice(2);
context.controller = controller;
context.action = action;
- return {
- action: result,
- context: context
- };
+ return new routeresults.RouteResult(result, context);
} else {
return routeresults.missingRoute('The "' + controller + '" controller doesn\'t have an action called "' + action + '"');
}

0 comments on commit 9640ab3

Please sign in to comment.