🪨 A well tested suite of tools designed to help FT.com applications be more reliable and measurable
Installations
npm install @dotcom-reliability-kit/crash-handler
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
20.x || 22.x
Node Version
22.13.0
NPM Version
10.9.2
Score
59.4
Supply Chain
98.8
Quality
90.4
Maintenance
100
Vulnerability
99.6
License
Releases
opentelemetry: v3.0.2
Updated on Mar 05, 2025
opentelemetry: v3.0.1
Updated on Feb 19, 2025
middleware-allow-request-methods: v1.0.0
Updated on Feb 12, 2025
fetch-error-handler: v1.0.0
Updated on Jan 30, 2025
opentelemetry: v3.0.0
Updated on Jan 21, 2025
serialize-request: v4.0.0
Updated on Jan 21, 2025
Contributors
Languages
JavaScript (98.32%)
TypeScript (1.2%)
CSS (0.34%)
Shell (0.15%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
Financial-Times
Download Statistics
Total Downloads
110,841
Last Day
264
Last Week
1,224
Last Month
5,778
Last Year
56,733
GitHub Statistics
MIT License
8 Stars
1,106 Commits
1 Forks
50 Watchers
7 Branches
33 Contributors
Updated on Mar 13, 2025
Bundle Size
27.55 kB
Minified
9.74 kB
Minified + Gzipped
Package Meta Information
Latest Version
5.0.0
Package Id
@dotcom-reliability-kit/crash-handler@5.0.0
Unpacked Size
5.91 kB
Size
2.43 kB
File Count
4
NPM Version
10.9.2
Node Version
22.13.0
Published on
Jan 21, 2025
Total Downloads
Cumulative downloads
Total Downloads
110,841
Last Day
22.8%
264
Compared to previous day
Last Week
1.8%
1,224
Compared to previous week
Last Month
-5.7%
5,778
Compared to previous month
Last Year
17.4%
56,733
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
@dotcom-reliability-kit/crash-handler
A method to bind an uncaught exception handler to ensure that fatal application errors are logged. It is a replacement for Sentry fatal error logging. This module is part of FT.com Reliability Kit.
Usage
Install @dotcom-reliability-kit/crash-handler
as a dependency:
1npm install --save @dotcom-reliability-kit/crash-handler
Include in your code:
1import registerCrashHandler from '@dotcom-reliability-kit/crash-handler'; 2// or 3const registerCrashHandler = require('@dotcom-reliability-kit/crash-handler');
registerCrashHandler
The registerCrashHandler
function can be used to bind an event handler to the Node.js process.uncaughtException
event. This ensures that your application logs a final message before crashing in the event on an unexpected error or promise rejection.
This function should only ever be called once in your app, normally alongside all your setup code (e.g. alongside creating an Express app).
[!TIP]
It's not a requirement, but generally the earlier the better with registering an uncaught exception handler – the sooner you register it the more likely you are to catch uncaught exceptions.
1registerCrashHandler();
If an error is thrown which will crash your application, error information will be logged and then the process will exit with the value of process.exitCode
or 1
.
Configuration options
Config options can be passed into the registerCrashHandler
function as an object with any of the keys below.
1registerCrashHandler({
2 // Config options go here
3});
options.logger
A logger object which implements two methods, error
and warn
, which have the following permissive signature:
1type LogMethod = (...logData: any) => any;
This is passed directly onto the relevant log-error method, see the documentation for that package for more details.
options.process
The Node.js Process object to bind the error handling event to. You may use this if you are using a child process or want to mock the process object in your tests.
1registerCrashHandler({
2 process: myProcessObject
3});
Compatibility
Migrating from Sentry
The Reliability Kit crash handler is a replacement for Sentry's uncaught exception handling, which your app is likely to be using. You'll need to migrate away from Sentry in order to use this module. We maintain a migration guide for this on Confluence.
Migrating
Consult the Migration Guide if you're trying to migrate to a later major version of this package.
Contributing
See the central contributing guide for Reliability Kit.
License
Licensed under the MIT license.
Copyright © 2022, The Financial Times Ltd.

No vulnerabilities found.

No security vulnerabilities found.