Package Exports
- @putout/plugin-apply-try-catch
- @putout/plugin-apply-try-catch/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@putout/plugin-apply-try-catch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@putout/plugin-apply-try-catch 
🐊Putout
plugin adds ability to apply tryCatch.
Install
npm i @putout/plugin-apply-try-catch
Rule
{
"rules": {
"apply-try-catch/try-catch": "on",
"apply-try-catch/try-to-catch": "on",
"apply-try-catch/await": "on"
}
}
tryCatch
❌ Incorrect code example
try {
log('hello');
} catch(error) {
}
✅ Correct code Example
const [error] = tryCatch(log, 'hello');
tryToCatch
❌ Incorrect code example
try {
await send('hello');
} catch(error) {
}
✅ Correct code Example
const [error] = await tryCatch(log, 'hello');
await
❌ Incorrect code example
await tryCatch(a, b);
tryToCatch(a, b);
✅ Correct code Example
await tryToCatch(a, b);
License
MIT