diff --git a/.changeset/nice-tools-cheat.md b/.changeset/nice-tools-cheat.md new file mode 100644 index 0000000000..c4f0e162bf --- /dev/null +++ b/.changeset/nice-tools-cheat.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Make `ExitCodeError` call `super` early to avoid compiler warnings diff --git a/packages/cli/src/lib/errors.ts b/packages/cli/src/lib/errors.ts index c0b4c45b6c..dd3955a10a 100644 --- a/packages/cli/src/lib/errors.ts +++ b/packages/cli/src/lib/errors.ts @@ -26,11 +26,11 @@ export class ExitCodeError extends CustomError { readonly code: number; constructor(code: number, command?: string) { - if (command) { - super(`Command '${command}' exited with code ${code}`); - } else { - super(`Child exited with code ${code}`); - } + super( + command + ? `Command '${command}' exited with code ${code}` + : `Child exited with code ${code}`, + ); this.code = code; } }