Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

cliErrors.ts

82 lines2.5 KB

1import * as Schema from "effect/Schema";
2​
3export class ServerCliCommandExitError extends Schema.TaggedError<ServerCliCommandExitError>()(
4 "ServerCliCommandExitError",
5 {
6 command: Schema.String,
7 args: Schema.Array(Schema.String),
8 cwd: Schema.optional(Schema.String),
9 exitCode: Schema.Int,
10 },
11) {
12 override get message(): string {
13 return `Command exited with non-zero exit code (${this.exitCode})`;
14 }
16​
17export class ServerCliPublishIconSourceMissingError extends Schema.TaggedError<ServerCliPublishIconSourceMissingError>()(
18 "ServerCliPublishIconSourceMissingError",
19 {
20 sourcePath: Schema.String,
21 },
22) {
23 override get message(): string {
24 return `Missing publish icon source: ${this.sourcePath}`;
25 }
27​
28export class ServerCliPublishIconTargetMissingError extends Schema.TaggedError<ServerCliPublishIconTargetMissingError>()(
29 "ServerCliPublishIconTargetMissingError",
30 {
31 targetPath: Schema.String,
32 },
33) {
34 override get message(): string {
35 return `Missing publish icon target: ${this.targetPath}. Run the build subcommand first.`;
36 }
38​
39export class ServerCliDevelopmentIconSourceMissingError extends Schema.TaggedError<ServerCliDevelopmentIconSourceMissingError>()(
40 "ServerCliDevelopmentIconSourceMissingError",
41 {
42 sourcePath: Schema.String,
43 },
44) {
45 override get message(): string {
46 return `Missing development icon source: ${this.sourcePath}`;
47 }
49​
50export class ServerCliDevelopmentIconTargetMissingError extends Schema.TaggedError<ServerCliDevelopmentIconTargetMissingError>()(
51 "ServerCliDevelopmentIconTargetMissingError",
52 {
53 targetPath: Schema.String,
54 },
55) {
56 override get message(): string {
57 return `Missing development icon target: ${this.targetPath}. Build web first.`;
58 }
60​
61export class ServerCliBuildAssetMissingError extends Schema.TaggedError<ServerCliBuildAssetMissingError>()(
62 "ServerCliBuildAssetMissingError",
63 {
64 assetPath: Schema.String,
65 },
66) {
67 override get message(): string {
68 return `Missing build asset: ${this.assetPath}. Run the build subcommand first.`;
69 }
71​
72export class ServerCliExecutableImportError extends Schema.TaggedError<ServerCliExecutableImportError>()(
73 "ServerCliExecutableImportError",
74 {
75 bundlePath: Schema.String,
76 specifiers: Schema.Array(Schema.String),
77 },
78) {
79 override get message(): string {
80 return `${this.bundlePath} imports file-backed packages that a single-executable cannot resolve: ${this.specifiers.join(", ")}. Load them through createRequire instead.`;
81 }