diff --git a/main.ts b/main.ts index 751f79a..28dab4f 100644 --- a/main.ts +++ b/main.ts @@ -14,6 +14,7 @@ import { set, } from "./src/commands/mod.ts"; import { getContext } from "./src/context.ts"; +import { ApplicationError } from "./src/errors/application.error.ts"; const args = Deno.args .filter((arg) => arg?.trim()) @@ -47,6 +48,10 @@ try { if (error instanceof TypeError) { console.error(`${brightRed("error")}: ${error.message}`); Deno.exit(1); + } else if (error instanceof ApplicationError) { + const { exitCode, code, message, name } = error; + console.error(`${brightRed("error")}: ${name} ${code} ${message}`); + Deno.exit(exitCode); } else { console.error(error); Deno.exit(1); diff --git a/src/errors/unsupportedFileKind.error.ts b/src/errors/unsupportedFileKind.error.ts index 184f7e2..b2cc169 100644 --- a/src/errors/unsupportedFileKind.error.ts +++ b/src/errors/unsupportedFileKind.error.ts @@ -9,7 +9,7 @@ export class UnsupportedFileKindError extends ApplicationError { super( ErrorCode.UnsupportedFileKind, ErrorExitCode.UnsupportedFileKind, - `File ${file} is not a supported kind (csproj)`, + `File ${file} is not a supported kind`, options, ); }