Skip to content

Commit

Permalink
fix: don't swallow validation errors
Browse files Browse the repository at this point in the history
Always trigger a CLIError
  • Loading branch information
tagoro9 committed Dec 12, 2023
1 parent 4dd78ab commit b3259a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cli/FotingoCommand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Command } from '@oclif/command';
import { IConfig } from '@oclif/config';
import { Errors } from '@oclif/core';
import { boundMethod } from 'autobind-decorator';
import { Debugger } from 'debug';
import envCi from 'env-ci';
Expand Down Expand Up @@ -70,6 +71,7 @@ export abstract class FotingoCommand<T, R> extends Command {

constructor(argv: string[], config: IConfig) {
super(argv, config);
console.log('Constructing command');
this.startTime = Date.now();
this.createConfigFolder();
this.isCi = envCi().isCi;
Expand Down Expand Up @@ -195,7 +197,7 @@ export abstract class FotingoCommand<T, R> extends Command {
const unknownError = error as unknown as Record<string, unknown>;
const errorCode =
'code' in unknownError && typeof unknownError.code === 'number' ? unknownError.code : 1;
this.exit(errorCode);
throw new Errors.CLIError(error, { exit: errorCode });
}

async finally(error?: Error): Promise<void> {
Expand All @@ -204,6 +206,7 @@ export abstract class FotingoCommand<T, R> extends Command {
}

async run(): Promise<void> {
console.log('Running command');
const { waitUntilExit } = renderUi({
cmd: () => {
const commandData = this.getCommandData();
Expand Down

0 comments on commit b3259a5

Please sign in to comment.