
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Doing something like this:
var p = Promise.reject(0);
setTimeout(() => p.catch(e => console.error('caught')), 0);
will generate a lot of helpful warnings:
(node:13548) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 0
(node:13548) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:13548) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
This module lets you write:
var p = caught(Promise.reject(0));
setTimeout(() => p.catch(e => console.error('caught')), 0);
to ignore those warnings on a per-promise basis.
Use at your own risk.
For more info see this answer on Stack Overflow:
To use in your projects:
npm install caught --save
var caught = require('caught');
var p = caught(Promise.reject(0));
Note that it is not the same as writing:
var p = Promise.reject(0).catch(() => {});
which would not return the original promise and wouldn't let you add catch
handlers later.
For any bug reports or feature requests please post an issue on GitHub.
MIT License (Expat). See LICENSE.md for details.
FAQs
Avoids UnhandledPromiseRejectionWarning and PromiseRejectionHandledWarning
The npm package caught receives a total of 2,102 weekly downloads. As such, caught popularity was classified as popular.
We found that caught demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.