Blog
Hook Node SDK Failures Without Taking Over the Process
A Node SDK should report its own failures and rethrow. Hooking uncaughtException globally steals the host app's crash policy. Capture at your boundary, then get out of the way.
2026-10-12 · 7 min read · AethelLayer
Your SDK is a guest in their process
process.on('uncaughtException') is the host application's decision. If your SDK installs one, you can swallow their crash, change their exit code, or fight the other library that installed one first. Capture errors at the functions you export.
Wrap the public async surface. On failure, send a probe with the error name, code, and stack, then rethrow the original error. Their try/catch and their process hooks still run.
Never let telemetry break the call
If the ingest request fails, the user's original error is the one that matters. Timeout the probe quickly, drop it on network failure, and do not reject their promise because your collector was down.
Redact before the POST. Authorization headers, query strings with tokens, and request bodies do not belong in the payload. Send the code, the route template, and the stack frames from your package.
Name the error so support can group it
Throw errors with a stable code property, not only a message. Messages get edited. Codes are what the inbox clusters. Include the SDK version on every probe so you can see which release started the spike.
For CLI wrappers around the SDK, the same error should become a non-zero exit and a stderr line. The probe is the third copy, for you, not a replacement for the developer's terminal.
Ask only when a human is at the keyboard
A library call inside a server request must not prompt. Prompt in the CLI, where a person just watched the command fail. The server path records the probe and stays quiet.
That split is how you get intent without blocking production traffic. The draft issue is created later, by your team, from the inbox.
Keep reading
Capture the failure before they leave
Capture the failure before they leave. Book early access or talk to sales, then install @aethellayer/sdk when you are onboarded.