From 014562a5ed2e6d924dac3c62b680d374709a5bdf Mon Sep 17 00:00:00 2001 From: Joseph Adams Date: Mon, 23 Sep 2024 14:35:34 -0400 Subject: [PATCH] fix: gracefully handle when satellite cannot bind REST port (#152) --- satellite/src/rest.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/satellite/src/rest.ts b/satellite/src/rest.ts index 859fdc2..b6f32dd 100644 --- a/satellite/src/rest.ts +++ b/satellite/src/rest.ts @@ -157,8 +157,12 @@ export class RestServer { const port = this.appConfig.get('restPort') if (enabled && port) { - this.server = this.app.listen(port) - console.log(`REST server starting: port: ${port}`) + try { + this.server = this.app.listen(port) + console.log(`REST server starting: port: ${port}`) + } catch (error) { + console.error('Error starting REST server:', error) + } } else { console.log('REST server not starting: port 0') }