Error type fixes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-10-18 13:03:28 -05:00
parent 8d1dcc87fb
commit 9ee4c42e43
7 changed files with 47 additions and 20 deletions

View File

@@ -169,8 +169,11 @@ export abstract class Directive extends AppClass {
const optionValues = this.parseOptions(options, argv)
this.setOptionValues(optionValues)
await this.handle(argv)
} catch (e) {
this.nativeOutput(e.message)
} catch (e: unknown) {
if ( e instanceof Error ) {
this.nativeOutput(e.message)
}
if ( e instanceof OptionValidationError ) {
// expecting, value, requirements
if ( e.context.expecting ) {
@@ -187,6 +190,7 @@ export abstract class Directive extends AppClass {
this.nativeOutput(` - ${e.context.value}`)
}
}
this.nativeOutput('\nUse --help for more info.')
}
}