* Map a thrown error to the standard `artifacts : * ` framing at exit 1. ArtifactError subclasses carry a * clean message; anything else stringifies its cause.
(subcommand: string, cause: unknown)
| 713 | * clean message; anything else stringifies its cause. |
| 714 | */ |
| 715 | function mapError(subcommand: string, cause: unknown): ArtifactsCLIResult { |
| 716 | if (cause instanceof ArtifactError) { |
| 717 | return { stdout: "", stderr: `artifacts ${subcommand}: ${cause.message}\n`, exitCode: 1 }; |
| 718 | } |
| 719 | const message = cause instanceof Error ? cause.message : String(cause); |
| 720 | return { stdout: "", stderr: `artifacts ${subcommand}: ${message}\n`, exitCode: 1 }; |
| 721 | } |
| 722 | |
| 723 | // --------------------------------------------------------------- |
| 724 | // flag parser |
no outgoing calls
no test coverage detected