Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ac93328

Browse files
rasmuserikdaviddias
authored andcommitted
refactor: consistent error handling in cli (#933)
License: MIT Signed-off-by: Rasmus Erik Voel Jensen <[email protected]>
1 parent a5e75e0 commit ac93328

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/cli/commands/init.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ module.exports = {
4444
if (err.code === 'EACCES') {
4545
err.message = `EACCES: permission denied, stat $IPFS_PATH/version`
4646
}
47-
console.error(err.toString())
48-
process.exit(1)
47+
throw err
4948
}
5049
})
5150
}

src/cli/commands/repo/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
handler (argv) {
1313
argv.ipfs.repo.version(function (err, version) {
1414
if (err) {
15-
return console.error(err)
15+
throw err
1616
}
1717
print(version)
1818
})

0 commit comments

Comments
 (0)