| ... | ... | @@ -4,12 +4,12 @@ import * as NodeRuntime from "@effect/platform-node/NodeRuntime"; |
| 4 | 4 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
| 5 | 5 | import { isCommandAvailable, resolveSpawnCommand } from "@t3tools/shared/shell"; |
| 6 | 6 | import * as Console from "effect/Console"; |
| 7 | | import * as Data from "effect/Data"; |
| 8 | 7 | import * as Effect from "effect/Effect"; |
| 9 | 8 | import * as FileSystem from "effect/FileSystem"; |
| 10 | 9 | import * as Logger from "effect/Logger"; |
| 11 | 10 | import * as Path from "effect/Path"; |
| 12 | 11 | import * as PlatformError from "effect/PlatformError"; |
| 12 | import * as Schema from "effect/Schema"; |
| 13 | 13 | import { Command } from "effect/unstable/cli"; |
| 14 | 14 | import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 15 | 15 | |
| ... | ... | @@ -18,9 +18,19 @@ interface NativeStaticTool { |
| 18 | 18 | readonly installHint: string; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | | class NativeStaticCheckError extends Data.TaggedError("NativeStaticCheckError")<{ |
| 22 | | readonly message: string; |
| 23 | | }> {} |
| 21 | export class NativeStaticCheckCommandError extends Schema.TaggedErrorClass<NativeStaticCheckCommandError>()( |
| 22 | "NativeStaticCheckCommandError", |
| 23 | { |
| 24 | command: Schema.String, |
| 25 | args: Schema.Array(Schema.String), |
| 26 | cwd: Schema.String, |
| 27 | exitCode: Schema.Int, |
| 28 | }, |
| 29 | ) { |
| 30 | override get message(): string { |
| 31 | return `Native static check command '${this.command}' exited with code ${this.exitCode}.`; |
| 32 | } |
| 33 | } |
| 24 | 34 | |
| 25 | 35 | const tools = [ |
| 26 | 36 | { |
| ... | ... | @@ -85,8 +95,11 @@ const runCommand = Effect.fn("runCommand")(function* ( |
| 85 | 95 | const exitCode = Number(yield* child.exitCode); |
| 86 | 96 | |
| 87 | 97 | if (exitCode !== 0) { |
| 88 | | return yield* new NativeStaticCheckError({ |
| 89 | | message: `Command exited with non-zero exit code (${exitCode})`, |
| 98 | return yield* new NativeStaticCheckCommandError({ |
| 99 | command, |
| 100 | args, |
| 101 | cwd, |
| 102 | exitCode, |
| 90 | 103 | }); |
| 91 | 104 | } |
| 92 | 105 | }); |