Skip to content

Commit

Permalink
Throw when router path or callback is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jan 6, 2011
1 parent 2d42fa5 commit a805ff9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/connect/middleware/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ function router(fn){
var localRoutes = routes[name] = routes[name] || [];
return function(path, fn){
var keys = [];
if (!path) throw new Error(name + ' route requires a path');
if (!fn) throw new Error(name + ' route ' + path + ' requires a callback');
path = path instanceof RegExp
? path
: normalizePath(path, keys);
Expand Down

0 comments on commit a805ff9

Please sign in to comment.