Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error status not always an integer, sometimes a string #325

Closed
jstayton opened this issue Dec 31, 2015 · 3 comments
Closed

Error status not always an integer, sometimes a string #325

jstayton opened this issue Dec 31, 2015 · 3 comments
Assignees

Comments

@jstayton
Copy link

Most (all?) of the errors produced by the library itself have an integer status. For example,

client.getSource({
  index: 'my_index',
  type: 'my_type',
  id: 'not_found'
})
.catch(function(error) {
  console.log(error.status);
});

outputs the integer 404.

When creating an error directly, however, it's a string. For example,

var errors = require('elasticsearch').errors;
var notFound = new errors.NotFound();

console.log(notFound.status);

outputs the string '404'.

Not a big deal, but it is somewhat annoying when you're doing something like error.status === 404.

@spalger spalger self-assigned this Dec 31, 2015
@spalger spalger added the bug label Dec 31, 2015
@spalger
Copy link
Contributor

spalger commented Dec 31, 2015

Good point

@spalger
Copy link
Contributor

spalger commented Jan 5, 2016

Closed by 0e3fe15

Will release soon

@spalger spalger closed this as completed Jan 5, 2016
@jstayton
Copy link
Author

jstayton commented Jan 5, 2016

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants