Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 1.94 KB

README.md

File metadata and controls

78 lines (62 loc) · 1.94 KB

Trymore

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.

Table of Contents

Type

  • ECMAScript Modules (ESM)
  • CommonJS (CJS)

Installation

npm install trymore
yarn add trymore

Example

CommonJS

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
  });

ES6

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
  });

License

trymore is licensed under the Apache-2.0