mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
Handle EACCES errors
This commit is contained in:
parent
af7a40bd68
commit
da02857a6e
@ -12,6 +12,9 @@ exports.handle = (error, exit = true) ->
|
||||
else if error.code is 'ENOENT'
|
||||
console.error("No such file or directory: #{error.path}")
|
||||
|
||||
else if error.code is 'EACCES'
|
||||
console.error('You don\'t have enough privileges to run this operation.')
|
||||
|
||||
else if error.message?
|
||||
console.error(error.message)
|
||||
|
||||
|
@ -77,3 +77,10 @@ describe 'Errors:', ->
|
||||
checkProcessExitOption error, false, (processExitStub, logErrorStub) ->
|
||||
expect(logErrorStub).to.have.been.calledOnce
|
||||
expect(logErrorStub).to.have.been.calledWith('No such file or directory: hello')
|
||||
|
||||
it 'should handle EACCES', ->
|
||||
error = new Error()
|
||||
error.code = 'EACCES'
|
||||
checkProcessExitOption error, false, (processExitStub, logErrorStub) ->
|
||||
expect(logErrorStub).to.have.been.calledOnce
|
||||
expect(logErrorStub).to.have.been.calledWith('You don\'t have enough privileges to run this operation.')
|
||||
|
Loading…
Reference in New Issue
Block a user