Skip to content

Fixed invalid variable name in error handling #69

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

Closed
wants to merge 2 commits into from

Conversation

nyurik
Copy link

@nyurik nyurik commented Oct 18, 2015

Fixed invalid variable reference
My IDE also auto-fixed trailing spaces in two places.

Yuri Astrakhan added 2 commits October 19, 2015 02:44
It seems the errors should be compared as is,
not to their negative.
// may have not be created as expected or the file was already closed
// by the user, in which case we will simply ignore the error
if (e.errno != -_c.EBADF && e.errno != -c.ENOENT) {
Copy link
Owner

Choose a reason for hiding this comment

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

Nice catch on the invalid variable, although we need the - here.

Copy link
Author

Choose a reason for hiding this comment

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

@raszi, in my testing, the error codes had positive values. E.g. on Ubuntu, I consistently was getting an error because the temp file was already closed, and the value was EBADF (positive). See https://github.com/kartotherian/tilerator/blob/master/lib/fileParser.js#L215

Copy link
Collaborator

Choose a reason for hiding this comment

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

@raszi AFAIK nodejs always used negative values but it can be that behavior has been changed... - therefore my initial Math.abs(), you remember?

#47 (comment)

@carnesen
Copy link

Came here to point out this referencing of an undefined variable. Looks like it's been fixed in master (October 2015) but not in the latest package on npm (September 2015). As for the positive / negative errno discussion. On my Mac with Node.js version 6.4, both c.ENOENT and c.EBADF are undefined. I believe these days the right thing to do is to check err.code against the strings 'EBADF' and / or 'ENOENT'. See nodejs/node-v0.x-archive#1905 (comment) for example.

@raszi
Copy link
Owner

raszi commented Nov 1, 2016

Fixed with #96

@raszi raszi closed this Nov 1, 2016
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

Successfully merging this pull request may close these issues.

4 participants