Skip to content

Commit 254d178

Browse files
committed
feat(deepnote-server): Improve error handling for IPv6 checks
Signed-off-by: Tomas Kislan <tomas@kislan.sk>
1 parent de2a31e commit 254d178

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/kernels/deepnote/deepnoteServerStarter.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
624624
try {
625625
const inUseIpv6 = await tcpPortUsed.check(port, '::1');
626626
return !inUseIpv6;
627-
} catch (error) {
628-
if (error instanceof Error && error.message.includes('EAFNOSUPPORT')) {
627+
} catch (error: unknown) {
628+
if (error instanceof Error && 'code' in error && error.code === 'EAFNOSUPPORT') {
629629
logger.debug('IPv6 is not supported on this system');
630630
return true;
631631
}

src/kernels/deepnote/deepnoteServerStarter.unit.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ suite('DeepnoteServerStarter - Port Allocation Integration Tests', () => {
120120
test('should return true when IPv6 is disabled (EAFNOSUPPORT error)', async () => {
121121
const port = 54324;
122122
const ipv6Error = new Error('connect EAFNOSUPPORT ::1:54324');
123+
(ipv6Error as any).code = 'EAFNOSUPPORT';
123124

124125
// IPv4 check succeeds (port is available)
125126
checkStub.onFirstCall().resolves(false);

0 commit comments

Comments
 (0)