diff --git a/packages/devframe/src/node/server.ts b/packages/devframe/src/node/server.ts index a30965f3..cfcef62d 100644 --- a/packages/devframe/src/node/server.ts +++ b/packages/devframe/src/node/server.ts @@ -110,6 +110,16 @@ export interface StartHttpAndWsOptions { * own startup banner. Devframe does not print one itself. */ onReady?: (info: { origin: string, port: number, app: H3 }) => void | Promise + /** + * Called for any error the HTTP server devframe owns emits after it starts + * listening — e.g. a transient `EMFILE` while accepting a connection. + * Without it such an error has no listener and crashes the process. + * + * Applies only to a server devframe created itself. When `server` is + * supplied the caller owns that object and attaches to it directly, so + * devframe leaves its error handling alone. + */ + onServerError?: (error: Error) => void } export interface StartedServer { @@ -279,6 +289,10 @@ export async function startHttpAndWs(options: StartHttpAndWsOptions): Promise