Browse files

Adding more explicit error when undefined is passed as uri or options.

  • Loading branch information...
1 parent f0052ac commit cea668f6f7d444831313ccc0e0d301d25f2bd421 @mikeal mikeal committed Mar 2, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 main.js
@@ -787,6 +787,7 @@ function initParams(uri, options, callback) {
function request (uri, options, callback) {
+ if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.')
if ((typeof options === 'function') && !callback) callback = options;
if (typeof options === 'object') {
options.uri = uri;

1 comment on commit cea668f

rgrove commented on cea668f Apr 9, 2012

This broke what I thought was a valid use case: setting options.uri or options.url to the URI and just doing request(options, callback). Easy enough to fix, but it's technically a backcompat breakage since that signature worked prior to 2.9.200. See rgrove/node-elastical#19

Please sign in to comment.