CatchContinue
A class to allow you to run segments of code in order, catch errors, and retry
or continue from where an error occured.
Installation
yarn add @netsells/catch-continue
Usage
import CatchContinue from '@netsells/catch-continue';
async function myFunction() {
const cc = new CatchContinue();
cc.add(() => {
});
cc.add(() => {
return Promise((resolve, reject) => {
});
});
cc.add(async () => {
await someCode();
});
try {
await cc.run('any', 'arguments');
} catch(e) {
cc.continue();
cc.retry();
}
}