chore: generate
This commit is contained in:
parent
29b5b24787
commit
818b56dbd0
3 changed files with 4 additions and 12 deletions
|
|
@ -406,9 +406,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
||||||
// Surface every failed endpoint in one labeled message instead of
|
// Surface every failed endpoint in one labeled message instead of
|
||||||
// letting the first rejection drown its siblings as unhandled
|
// letting the first rejection drown its siblings as unhandled
|
||||||
// rejections.
|
// rejections.
|
||||||
const failure = aggregateFailures(
|
const failure = aggregateFailures(blockingRequests.map((r, i) => ({ name: r.name, result: settled[i] })))
|
||||||
blockingRequests.map((r, i) => ({ name: r.name, result: settled[i] })),
|
|
||||||
)
|
|
||||||
if (failure) throw failure
|
if (failure) throw failure
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,13 @@ describe("aggregateFailures", () => {
|
||||||
|
|
||||||
test("attaches structured failure list under .cause", () => {
|
test("attaches structured failure list under .cause", () => {
|
||||||
const reason = new Error("nope")
|
const reason = new Error("nope")
|
||||||
const err = aggregateFailures([
|
const err = aggregateFailures([{ name: "providers", result: { status: "rejected", reason } }])
|
||||||
{ name: "providers", result: { status: "rejected", reason } },
|
|
||||||
])
|
|
||||||
const cause = err!.cause as { failures: Array<{ name: string; reason: unknown }> }
|
const cause = err!.cause as { failures: Array<{ name: string; reason: unknown }> }
|
||||||
expect(cause.failures).toEqual([{ name: "providers", reason }])
|
expect(cause.failures).toEqual([{ name: "providers", reason }])
|
||||||
})
|
})
|
||||||
|
|
||||||
test("falls back to String() for opaque reasons", () => {
|
test("falls back to String() for opaque reasons", () => {
|
||||||
const err = aggregateFailures([
|
const err = aggregateFailures([{ name: "x", result: { status: "rejected", reason: 42 } }])
|
||||||
{ name: "x", result: { status: "rejected", reason: 42 } },
|
|
||||||
])
|
|
||||||
expect(err!.message).toContain("x: 42")
|
expect(err!.message).toContain("x: 42")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,7 @@ const setupWorkspace = (kind: string) =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const dir = yield* tmpdirScoped({ git: true })
|
const dir = yield* tmpdirScoped({ git: true })
|
||||||
yield* Project.use.fromDirectory(dir)
|
yield* Project.use.fromDirectory(dir)
|
||||||
const projectID = yield* Project.Service.use((svc) =>
|
const projectID = yield* Project.Service.use((svc) => svc.fromDirectory(dir).pipe(Effect.map((p) => p.project.id)))
|
||||||
svc.fromDirectory(dir).pipe(Effect.map((p) => p.project.id)),
|
|
||||||
)
|
|
||||||
registerAdapter(projectID, kind, localAdapter(dir))
|
registerAdapter(projectID, kind, localAdapter(dir))
|
||||||
const workspace = yield* Workspace.Service.use((svc) =>
|
const workspace = yield* Workspace.Service.use((svc) =>
|
||||||
svc.create({ type: kind, branch: null, extra: null, projectID }),
|
svc.create({ type: kind, branch: null, extra: null, projectID }),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue