Skip to content

This function helps you handle errors in a flexible and customizable way, allowing you to retry operations by passing a new callback to the trymore method.

4i8/trymore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

This function helps you handle errors in a flexible and customizable way, allowing you to retry operations by passing a new callback to the trymore method.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published