Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(shared): give CommandResolutionError a message #7502

Closedkrutftw(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7502/headopened View on GitHub

Showing 1 changed file with 5 additions and 1 deletion.

x
0 of 1 viewed, 1 left
5 additions and 1 deletionpackages/shared/src/shell.tsModified
View file
@@ -47,7 +47,11 @@
export class CommandResolutionError extends Data.TaggedError("CommandResolutionError")<{
readonly command: string;
readonly reason: "not-found";
-}> {}
+}> {
+ override get message(): string {
+ return `Command "${this.command}" could not be resolved (${this.reason}).`;
Thread on lines 52 to 52
macroscopeapp[bot](GitHub profile, opens in a new tab)commented

The derived message re-states reason, which only ever has the single value "not-found" and is already encoded by the CommandResolutionError tag — that discriminates the same failure twice. Consider deriving the message from command alone, and dropping the singleton reason field (plus its four construction sites in this file) so there is one coherent model.

Suggested change
52- return `Command "${this.command}" could not be resolved (${this.reason}).`;
52+ return `Command "${this.command}" could not be resolved.`;
Posted via Macroscope — Effect Service Conventions
+ }
+}
​
const WINDOWS_SHELL_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
​