This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy patherrors.ts
More file actions
53 lines (45 loc) · 1.27 KB
/
errors.ts
File metadata and controls
53 lines (45 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Typebox } from "./deps.ts";
import { ajv } from './util/ajv.ts';
export class RenderCLIError extends Error {
}
export class InitRequiredError extends RenderCLIError {
constructor(msg: string) {
super(`${msg}; run 'render config init' to create a config file.`);
}
}
export class ForceRequiredError extends RenderCLIError {
constructor(msg: string) {
super(`${msg}; pass --force to do this anyway.`);
}
}
export class PathNotFound extends RenderCLIError {
constructor (
path: string,
cause: Deno.errors.NotFound,
) {
super(`path '${path}' not found or not readable.`, { cause });
}
}
export class RepoNotFound extends RenderCLIError {
constructor (
name: string,
) {
super(`Repo '${name}' not found.`);
}
}
export class APIKeyRequired extends RenderCLIError {
constructor() {
super(
'No API key found. Please set the RENDERCLI_APIKEY environment variable or run `render config init`.',
);
}
}
export class ValidationFailed extends RenderCLIError {
constructor(schema: Typebox.TSchema, errors: typeof ajv.errors) {
super(
`Error validating object of type ${schema.title ?? schema.$id ?? 'unknown'}: ` +
"\n\n" +
(errors ?? []).map((error:any) => ajv.errorsText([error])).join("\n")
);
}
}