Skip to content

Commit 09f2774

Browse files
committed
fix lint errors, better error handling in ada-node
1 parent e768670 commit 09f2774

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/adapter-node/src/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ const dirname = new URL('.', import.meta.url).pathname;
66
const instrumentFile = join(dirname, 'server', 'instrument.server.js');
77

88
if (existsSync(instrumentFile)) {
9-
import(instrumentFile).then((hooks) => {
10-
if (hooks?.instrument && typeof hooks.instrument === 'function') {
11-
hooks.instrument();
12-
}
13-
import('./start.js');
14-
});
9+
import(instrumentFile)
10+
.catch((err) => {
11+
console.error('Failed to import instrument.server.js', err);
12+
})
13+
.finally(() => {
14+
tryImportStart();
15+
});
1516
} else {
16-
import('c');
17+
tryImportStart();
18+
}
19+
20+
function tryImportStart() {
21+
import('./start.js').catch((err) => {
22+
console.error('Failed to import server (start.js)', err);
23+
});
1724
}

0 commit comments

Comments
 (0)