@putout/plugin-apply-cause
🐊Putout plugin adds ability to apply 'cause'
Last updated a month ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-cause 
SYNC missed versions from official npm registry.

@putout/plugin-apply-cause NPM version

The cause data property of an Error instance indicates the specific original cause of the error.:

(c) MDN

🐊Putout plugin adds ability to apply cause

Checkout in 🐊Putout Editor.

Install

npm i @putout/plugin-apply-cause

Rule

{
    "rules": {
        "apply-cause": "on"
    }
}

❌ Example of incorrect code

try {} catch(error) {
    if (controller.signal.aborted)
        throw Error('timeout');
}

✅ Example of correct code

try {} catch(error) {
    if (controller.signal.aborted)
        throw Error('timeout', {
            cause: error,
        });
}

License

MIT

Current Tags

  • 1.0.0                                ...           latest (a month ago)

2 Versions

  • 1.0.0                                ...           a month ago
  • 0.0.0-stage                                ...           a month ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 2
Last Month 0
Dependencies (0)
None
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE