Skip to content

Commit e587f17

Browse files
committed
fix: catch and output bootstrap errors properly
1 parent 2e14391 commit e587f17

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bootstrap.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ interface BootstrapResult {
2020
shutdown: () => void;
2121
}
2222

23+
const logger = getLogger("bootstrap");
24+
2325
// Main entrypoint to the application, where all the startup logic is defined.
2426
// This function is immediately invoked when the file is imported.
2527
// For testing purposes, the function is exported and provides some helpers.
2628
export const bootstrap = (async (): Promise<BootstrapResult> => {
2729
// Load the configuration first to make sure it's valid.
2830
const config = getConfig();
29-
const logger = getLogger("bootstrap");
3031

3132
const server = new Server();
3233

@@ -61,4 +62,7 @@ export const bootstrap = (async (): Promise<BootstrapResult> => {
6162
server,
6263
shutdown: () => server?.close(),
6364
};
64-
})();
65+
})().catch((error) => {
66+
logger.error({ error }, "Failed to start server");
67+
process.exit(1);
68+
});

0 commit comments

Comments
 (0)