logo

cafsue

The cafsue function stands for call async functions sequentially until error. It executes a list of async functions in sequence, the execution stops if a function throws or returns an error.

import { cafsue } from '@aracna/core';

(async () => {
  let number;

  await cafsue(
    async () => number++,
    async () => new Error(),
    async () => number++
  );

  // will log 1
  console.log(number);
})();