Trymore
is a flexible and customizable function for handling errors It allows you to retry operations by passing a new callback to the trymore() method. The function is simple yet powerful, and can be easily integrated into your projects.
- ECMAScript Modules (ESM)
- CommonJS (CJS)
npm install trymore
yarn add trymore
const trymore = require("trymore").default;
trymore(() => {
//just to throw an error
console.log(focus());
[].toErrorTestTest();
throw new Error("Test");
})
.trymore(() => {
console.log("success"); //stop here because no error, game over
})
.trymore(() => {
throw new Error("Any Error"); //disregard this because the second trymore is already success
});
import trymore from "trymore";
trymore(() => {
//just to throw an error
console.log(focus());
[].toErrorTestTest();
throw new Error("Test");
})
.trymore(() => {
console.log("success"); //stop here because no error, game over
})
.trymore(() => {
throw new Error("Any Error"); //disregard this because the second trymore is already success
});
trymore is licensed under the Apache-2.0