Skip to content

Commit

Permalink
fix exists callback error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
segayuu committed Jul 17, 2018
1 parent 6f1575a commit 97fd14f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ describe('fs', function() {

it('exists() - callback', function(callback) {
fs.exists(tmpDir, function(exist) {
exist.should.be.true;
try {
exist.should.be.true;
} catch (e) {
callback(e);
return;
}
callback();
});
});
Expand Down Expand Up @@ -969,7 +974,12 @@ describe('fs', function() {
createDummyFolder(target).asCallback(tiferr(callback, function() {
fs.rmdir(target, tiferr(callback, function() {
fs.exists(target, function(exist) {
exist.should.be.false;
try {
exist.should.be.false;
} catch (e) {
callback(e);
return;
}
callback();
});
}));
Expand Down

0 comments on commit 97fd14f

Please sign in to comment.