Add unpack state, command not found errors

This commit is contained in:
garrettmills
2020-03-03 21:06:59 -06:00
parent 9291c52383
commit ec8047361c
6 changed files with 91 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
const { Injectable } = require('flitter-di')
const ImplementationError = require('libflitter/errors/ImplementationError')
const PermissionDeniedError = require('../logical/error/PermissionDeniedError')
const CommandNotFoundError = require('../logical/error/CommandNotFoundError')
const uuid = require('uuid/v4')
const UniversalPath = require('../logical/UniversalPath')
const SystemMetrics = require('../logical/SystemMetrics')
@@ -213,10 +214,18 @@ class Host extends Injectable {
'permission denied'
]
const not_found_phrases = [
'command not found',
]
for ( const phrase of access_denied_phrases ) {
if ( both.includes(phrase) ) return PermissionDeniedError
}
for ( const phrase of not_found_phrases ) {
if ( both.includes(phrase) ) return CommandNotFoundError
}
return Error
}
}