@opencode/util 0.0.0-dev-955 → 0.0.0-dev-960

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/npm.d.ts CHANGED
@@ -7,6 +7,7 @@ declare const InstallFailedError_base: Schema.Class<InstallFailedError, Schema.T
7
7
  readonly cause: Schema.optional<Schema.Defect>;
8
8
  }>, import("effect/Cause").YieldableError>;
9
9
  export declare class InstallFailedError extends InstallFailedError_base {
10
+ get message(): string;
10
11
  }
11
12
  export interface Package {
12
13
  readonly directory: string;
package/dist/npm.js CHANGED
@@ -13,6 +13,16 @@ export class InstallFailedError extends Schema.TaggedError()("NpmInstallFailedEr
13
13
  dir: Schema.String,
14
14
  cause: Schema.optional(Schema.Defect()),
15
15
  }) {
16
+ get message() {
17
+ const summary = `Failed to install ${this.add?.join(", ") || this.dir}`;
18
+ if (!(this.cause instanceof Error))
19
+ return summary;
20
+ // @npmcli/git reports most failures as "An unknown git error occurred" and keeps git's output on `stderr`.
21
+ const stderr = "stderr" in this.cause && typeof this.cause.stderr === "string" ? this.cause.stderr.trim() : "";
22
+ if (!stderr)
23
+ return `${summary}: ${this.cause.message}`;
24
+ return `${summary}: ${this.cause.message}\n${stderr}`;
25
+ }
16
26
  }
17
27
  export class Service extends Context.Service()("@opencode/Npm") {
18
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/util",
4
- "version": "0.0.0-dev-955",
4
+ "version": "0.0.0-dev-960",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {