balena-cli/lib/errors/errors.coffee

15 lines
346 B
CoffeeScript
Raw Normal View History

2014-11-24 18:00:35 +00:00
TypedError = require('typed-error')
log = require('../log/log')
exports.NotFound = class NotFound extends TypedError
2014-11-24 18:41:16 +00:00
constructor: (name) ->
2014-11-24 18:00:35 +00:00
@message = "Couldn't find #{name}"
exports.handle = (error, exit = true) ->
return if not error? or error not instanceof Error
if error.message?
log.error(error.message)
process.exit(1) if exit