Skip to content

Commit

Permalink
Adding more explicit error when undefined is passed as uri or options.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Mar 2, 2012
1 parent f0052ac commit cea668f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

1 comment on commit cea668f

@rgrove
Copy link

@rgrove rgrove commented on cea668f Apr 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.