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

fix try catch #802

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/copy/__tests__/copy-permissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ describe('copy', () => {

try {
gidWheel = process.getgid() // userid.gid('wheel')
} catch {
} catch (error) {
gidWheel = process.getgid()
}

try {
gidStaff = process.getgid() // userid.gid('staff')
} catch {
} catch (error) {
gidStaff = process.getgid()
}

Expand Down
2 changes: 1 addition & 1 deletion lib/empty/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function emptyDirSync (dir) {
let items
try {
items = fs.readdirSync(dir)
} catch {
} catch (error) {
return mkdir.mkdirsSync(dir)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ensure/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function createFileSync (file) {
let stats
try {
stats = fs.statSync(file)
} catch {}
} catch (error) {}
if (stats && stats.isFile()) return

const dir = path.dirname(file)
Expand Down
2 changes: 1 addition & 1 deletion lib/ensure/symlink-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function symlinkTypeSync (srcpath, type) {
if (type) return type
try {
stats = fs.lstatSync(srcpath)
} catch {
} catch (error) {
return 'file'
}
return (stats && stats.isDirectory()) ? 'dir' : 'file'
Expand Down
2 changes: 1 addition & 1 deletion lib/mkdirs/__tests__/issue-209.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('mkdirp: issue-209, win32, when bad path, should return a cleaner error
try {
const file = 'c:\\tmp\foo:moo'
fse.mkdirpSync(file)
} catch {
} catch (error) {
didErr = true
}
assert(didErr)
Expand Down
4 changes: 2 additions & 2 deletions lib/mkdirs/make-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports.makeDir = async (input, options) => {
// it is caught below, and the original error is thrown
throw new Error('The path is not a directory')
}
} catch {
} catch (error) {
throw error
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ module.exports.makeDirSync = (input, options) => {
// it is caught below, and the original error is thrown
throw new Error('The path is not a directory')
}
} catch {
} catch (error) {
throw error
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/move-sync/__tests__/move-sync.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe('moveSync()', () => {
// make sure we have permission on device
try {
fs.writeFileSync(path.join(differentDevice, 'file'), 'hi')
} catch {
} catch (error) {
console.log("Can't write to device. Skipping moveSync test.")
__skipTests = true
}
Expand Down
2 changes: 1 addition & 1 deletion lib/move/__tests__/move.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe('+ move()', () => {
// make sure we have permission on device
try {
fs.writeFileSync(path.join(differentDevice, 'file'), 'hi')
} catch {
} catch (error) {
console.log("Can't write to device. Skipping move test.")
__skipTests = true
}
Expand Down
2 changes: 1 addition & 1 deletion lib/remove/rimraf.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function rmkidsSync (p, options) {
try {
const ret = options.rmdirSync(p, options)
return ret
} catch {}
} catch (error) {}
} while (Date.now() - startTime < 500) // give up after 500ms
} else {
const ret = options.rmdirSync(p, options)
Expand Down