diff --git a/cli/commands/publish.ts b/cli/commands/publish.ts index 9d3426e..fe822dd 100644 --- a/cli/commands/publish.ts +++ b/cli/commands/publish.ts @@ -1,5 +1,6 @@ import { Colors, Path, FS, Compress, Base64 } from "../deps.ts"; import { getMeta, IMeta, log, getConfig } from "../global.ts"; +import { ServerError } from "../helper/server_error.ts"; async function runScript(script: string) { console.log(Colors.bold(Colors.blue("Running script:")), script); @@ -104,17 +105,20 @@ export default async function publish(options: { dry: boolean }) { .then((res) => res.status === 200 ? res.json() - : Promise.reject(new Error(res.statusText)) + : Promise.reject(new ServerError(res.statusText)) ) .then((res) => { if (!res.success) { - throw new Error(res.message); + throw new ServerError(res.message); } else { console.log(Colors.green("Upload successfull")); } }) .catch((err) => { - console.log(Colors.red("Error: " + err.message)); + //import { ServerError } from "../helper/server_error.ts"; + if (err instanceof ServerError) + console.log(Colors.red("Server Error: " + err.message)); + else console.log(Colors.red("Error: " + err.message)); }); } else { console.log(Colors.yellow("Dry run. Skipping upload")); diff --git a/cli/deps.ts b/cli/deps.ts index a3ff6ac..1bbbe94 100644 --- a/cli/deps.ts +++ b/cli/deps.ts @@ -1,6 +1,6 @@ export * as Compress from "https://deno.hibas123.de/raw/@denreg-tar/mod.ts"; -export * as Ini from "https://deno.land/x/ini/mod.ts"; -export * as Cliffy from "https://deno.land/x/cliffy/mod.ts"; +export * as Ini from "https://deno.land/x/ini@v2.1.0/mod.ts"; +export * as Cliffy from "https://deno.land/x/cliffy@v0.14.1/mod.ts"; export * as Base64 from "https://deno.land/std@0.65.0/encoding/base64.ts"; export * as FS from "https://deno.land/std@0.65.0/fs/mod.ts"; export * as Colors from "https://deno.land/std@0.65.0/fmt/colors.ts"; diff --git a/cli/helper/server_error.ts b/cli/helper/server_error.ts new file mode 100644 index 0000000..7482cf8 --- /dev/null +++ b/cli/helper/server_error.ts @@ -0,0 +1,5 @@ +export class ServerError extends Error { + constructor(message: string) { + super(message); + } +}