@cardstack/boxel-cli 0.3.0-unstable.13 → 0.3.0-unstable.58
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/bundled-types/base/card-serialization.d.ts +1 -1
- package/bundled-types/boxel-ui/icons.gts +0 -3
- package/bundled-types/host-app/commands/create-submission-workflow.ts +2 -2
- package/bundled-types/host-app/commands/get-available-realm-identifiers.ts +1 -1
- package/bundled-types/host-app/commands/get-catalog-realm-identifiers.ts +1 -1
- package/bundled-types/host-app/commands/search-cards.ts +1 -1
- package/bundled-types/host-app/components/card-catalog/modal.gts +3 -3
- package/bundled-types/host-app/components/card-search/panel.gts +1 -1
- package/bundled-types/host-app/components/card-search/search-content.gts +2 -2
- package/bundled-types/host-app/components/operator-mode/code-submode/format-chooser.gts +12 -9
- package/bundled-types/host-app/components/operator-mode/code-submode/module-inspector.gts +1 -1
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-panel.gts +3 -3
- package/bundled-types/host-app/components/operator-mode/create-file-modal.gts +2 -2
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/index.gts +32 -24
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/workspace.gts +36 -23
- package/bundled-types/host-app/components/realm-picker/index.gts +2 -2
- package/bundled-types/host-app/components/search-sheet/index.gts +1 -1
- package/bundled-types/host-app/components/with-known-realms-loaded.gts +1 -1
- package/bundled-types/host-app/services/host-mode-service.ts +21 -2
- package/bundled-types/host-app/services/matrix-service.ts +9 -8
- package/bundled-types/host-app/services/operator-mode-state-service.ts +8 -6
- package/bundled-types/host-app/services/realm-server.ts +18 -16
- package/bundled-types/host-app/services/store.ts +1 -1
- package/bundled-types/host-app/utils/card-search/url.ts +6 -2
- package/bundled-types/host-tests/helpers/index.gts +2 -2
- package/dist/index.js +68 -68
- package/package.json +1 -1
- package/src/commands/realm/publish.ts +10 -1
- package/src/commands/realm/unpublish.ts +2 -3
- package/src/lib/describe-fetch-error.ts +25 -0
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '../../lib/profile-manager';
|
|
8
8
|
import { unpublishRealm } from './unpublish';
|
|
9
9
|
import { FG_CYAN, FG_GREEN, FG_RED, RESET } from '../../lib/colors';
|
|
10
|
+
import { describeFetchError } from '../../lib/describe-fetch-error';
|
|
10
11
|
|
|
11
12
|
const DEFAULT_TIMEOUT_MS = 300_000;
|
|
12
13
|
const READINESS_POLL_INTERVAL_MS = 1000;
|
|
@@ -193,7 +194,7 @@ async function waitForPublishedRealmReady(
|
|
|
193
194
|
}
|
|
194
195
|
lastError = `HTTP ${response.status}`;
|
|
195
196
|
} catch (error) {
|
|
196
|
-
lastError =
|
|
197
|
+
lastError = describeFetchError(error);
|
|
197
198
|
}
|
|
198
199
|
let remaining = timeoutMs - (Date.now() - startedAt);
|
|
199
200
|
if (remaining <= 0) break;
|
|
@@ -276,6 +277,14 @@ export function registerPublishCommand(realm: Command): void {
|
|
|
276
277
|
console.error(
|
|
277
278
|
`${FG_RED}Error:${RESET} ${err instanceof Error ? err.message : String(err)}`,
|
|
278
279
|
);
|
|
280
|
+
// Node's fetch surfaces the actual transport error (ECONNRESET,
|
|
281
|
+
// TLS failure, undici socket error, etc.) on `error.cause`. Print
|
|
282
|
+
// it so opaque "fetch failed" messages don't strand the caller.
|
|
283
|
+
// `!= null` rather than a truthy check so we don't drop
|
|
284
|
+
// falsy-but-defined causes (`''`, `0`, `false`, `NaN`).
|
|
285
|
+
if (err instanceof Error && err.cause != null) {
|
|
286
|
+
console.error(`${FG_RED}Caused by:${RESET}`, err.cause);
|
|
287
|
+
}
|
|
279
288
|
process.exit(1);
|
|
280
289
|
}
|
|
281
290
|
},
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type ProfileManager,
|
|
7
7
|
} from '../../lib/profile-manager';
|
|
8
8
|
import { FG_CYAN, FG_GREEN, FG_RED, RESET } from '../../lib/colors';
|
|
9
|
+
import { describeFetchError } from '../../lib/describe-fetch-error';
|
|
9
10
|
|
|
10
11
|
export interface UnpublishOptions {
|
|
11
12
|
/**
|
|
@@ -67,9 +68,7 @@ export async function unpublishRealm(
|
|
|
67
68
|
return {
|
|
68
69
|
publishedRealmURL: normalized,
|
|
69
70
|
unpublished: false,
|
|
70
|
-
error: `Failed to reach realm server: ${
|
|
71
|
-
err instanceof Error ? err.message : String(err)
|
|
72
|
-
}`,
|
|
71
|
+
error: `Failed to reach realm server: ${describeFetchError(err)}`,
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Node's `fetch` error surface is shallow: the outer error is always
|
|
2
|
+
// `TypeError: fetch failed`, and the *real* reason (ECONNRESET, TLS
|
|
3
|
+
// failure, undici socket error, etc.) lives on `error.cause`. Inline
|
|
4
|
+
// both when summarizing a failed fetch for log output or for embedding
|
|
5
|
+
// in a result string returned from a higher-level operation, so that
|
|
6
|
+
// opaque "fetch failed" lines don't reach the operator without context.
|
|
7
|
+
//
|
|
8
|
+
// `error.cause != null` rather than a truthy check so we don't drop
|
|
9
|
+
// falsy-but-defined causes (`''`, `0`, `false`, `NaN`). `!= null`
|
|
10
|
+
// matches both `null` and `undefined` — i.e., the absence markers —
|
|
11
|
+
// and lets every explicit value through.
|
|
12
|
+
//
|
|
13
|
+
// For user-facing CLI output where the full nested Error (including
|
|
14
|
+
// stack frames) is useful, prefer logging `err` and `err.cause` as
|
|
15
|
+
// separate console.error arguments so Node pretty-prints them. This
|
|
16
|
+
// helper is for the case where the output needs to be a single string.
|
|
17
|
+
export function describeFetchError(error: unknown): string {
|
|
18
|
+
let msg = error instanceof Error ? error.message : String(error);
|
|
19
|
+
if (error instanceof Error && error.cause != null) {
|
|
20
|
+
let cause = error.cause;
|
|
21
|
+
let causeMsg = cause instanceof Error ? cause.message : String(cause);
|
|
22
|
+
return `${msg} (caused by: ${causeMsg})`;
|
|
23
|
+
}
|
|
24
|
+
return msg;
|
|
25
|
+
}
|