trymore
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i trymore

Weekly Downloads

3

Version

0.0.1

License

Apache-2.0

Unpacked Size

6.95 kB

Total Files

7

Last publish

Collaborators

  • iarth