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 and tryToCatch.
Install
npm i @putout/plugin-apply-try-catchRule
{
"rules": {
"apply-try-catch/try-catch": "on",
"apply-try-catch/try-to-catch": "on",
"apply-try-catch/await": "on",
"apply-try-catch/args": "on"
}
}tryCatch
❌ Example of incorrect code
try {
log('hello');
} catch(error) {
}✅ Example of correct code
import tryCatch from 'try-catch';
const [error] = tryCatch(log, 'hello');tryToCatch
❌ Example of incorrect code
try {
await send('hello');
} catch(error) {
}✅ Example of correct code
import tryToCatch from 'try-catch';
const [error] = await tryToCatch(send, 'hello');await
❌ Example of incorrect code
await tryCatch(a, b);
tryToCatch(a, b);✅ Example of correct code
await tryToCatch(a, b);args
❌ Example of incorrect code
tryCatch(send('hello'));✅ Example of correct code
tryCatch(send, 'hello');License
MIT