Skip to content
Myr

change router callback check error message

Before adoption: this commit came in with the history the project adopted, so no landing records it.

to read:

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent 618484a · Browse files · 1 file+6 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Error: .get() requires callback functions but got a [object String]

Diff stats

1 file+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:lib/router/index.js+6 added-4 removed
14 unmodified lines
15exports = module.exports = Router;1617/**18 * Initialize a new `Router` with the given `options`.19 * 19 *20 * @param {Object} options21 * @api private22 */23
115 unmodified lines
139 }140 };141142 param(err);143 143144 // single param callbacks145 function paramCallback(err) {146 var fn = paramCallbacks[paramIndex++];147 if (err || !fn) return param(err);
96 unmodified lines
244 // ensure path was given245 if (!path) throw new Error('Router#' + method + '() requires a path');246247 // ensure all callbacks are functions248 callbacks.forEach(function(fn){248 callbacks.forEach(function(fn, i){249 if ('function' == typeof fn) return;250 throw new Error('Router#' + method + '() requires all callbacks to be functions');250 var type = {}.toString.call(fn);251 var msg = '.' + method + '() requires callback functions but got a ' + type;252 throw new Error(msg);253 });254255 // create the route256 debug('defined %s %s', method, path);
17 unmodified lines