Permalink
Browse files

lib: clean up usage of threw

Use try/catch to instead of threw.

PR-URL: #10534
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information...
JacksonTian authored and MylesBorins committed Aug 11, 2016
1 parent 5696223 commit 4e717820a0ab01ec2567d8de9500ed173dafed60
Showing with 6 additions and 12 deletions.
  1. +6 −12 lib/internal/bootstrap_node.js
@@ -317,20 +317,14 @@
}
function tryGetCwd(path) {
var threw = true;
var cwd;
try {
cwd = process.cwd();
threw = false;
} finally {
if (threw) {
// getcwd(3) can fail if the current working directory has been deleted.
// Fall back to the directory name of the (absolute) executable path.
// It's not really correct but what are the alternatives?
return path.dirname(process.execPath);
}
return process.cwd();
} catch (ex) {
// getcwd(3) can fail if the current working directory has been deleted.
// Fall back to the directory name of the (absolute) executable path.
// It's not really correct but what are the alternatives?
return path.dirname(process.execPath);
}
return cwd;
}
function evalScript(name) {

0 comments on commit 4e71782

Please sign in to comment.