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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/tmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function _rmdirRecursiveSync(root) {
if (!deferred) {
deferred = true;
dirs.push(dir);
}
}
dirs.push(file);
} else {
fs.unlinkSync(file);
Expand Down Expand Up @@ -349,10 +349,10 @@ function _prepareTmpFileRemoveCallback(name, fd, opts) {
fs.closeSync(fdPath[0]);
}
catch (e) {
// under some node/windows related circumstances, a temporary file
// under some node/windows related circumstances, a temporary file
// 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) {
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)

// reraise any unanticipated error
throw e;
}
Expand Down