mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 21:57:51 +00:00
Implement handy logErrorOrContinue
This commit is contained in:
parent
798a3ded61
commit
fa47ad1201
14
lib/error/error.coffee
Normal file
14
lib/error/error.coffee
Normal file
@ -0,0 +1,14 @@
|
||||
exports.logErrorOrContinue = (func, context) ->
|
||||
return ->
|
||||
try
|
||||
func.apply(context, arguments)
|
||||
catch error
|
||||
|
||||
# TODO: There should be a log module that takes
|
||||
# care of logging, and this should delegate to it
|
||||
console.error("Error: #{error.message}")
|
||||
|
||||
# TODO: Allow errors to save an error code
|
||||
# and use that here if it exists
|
||||
process.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user