Skip to content

Commit 3c2009a

Browse files
committed
fix(devframe): handle non-Error listen failures
The DF0052 catch assumed the caught value was an Error and cast both `message` and `cause`. `listen()` can throw arbitrary values, so derive the reason with the `error instanceof Error ? error.message : String(error)` pattern already used at both DF0045 call sites in instance-registry.ts, and pass the original value through as `cause` uncast. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 0041d0f commit 3c2009a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/devframe/src/node/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ export async function startHttpAndWs(options: StartHttpAndWsOptions): Promise<St
272272
// The WS transport is already attached above, so tear it down before
273273
// surfacing the failure rather than leaking it and its peers.
274274
await closeWs().catch(() => {})
275-
throw diagnostics.DF0052({ host: bindHost, port, reason: (error as Error).message, cause: error as Error })
275+
throw diagnostics.DF0052({
276+
host: bindHost,
277+
port,
278+
reason: error instanceof Error ? error.message : String(error),
279+
cause: error,
280+
})
276281
}
277282
}
278283

0 commit comments

Comments
 (0)