1.0.1 • Published 11 months ago

@arcscord/error v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@arcscord/error

A error handling package, inspired of golang error handling.

Exemple

import { Result, error, ok } from "@arscord/error";

const foo = (num: number): Result<boolean, Error> => {
  if (num <= 0) {
    return error(new Error("Get negative number"));
  }
  return ok(num % 2 === 0);
}

const [isFoo, err] = foo(3);
if (err) {
  console.error(err);
} else {
  console.log(isFoo);
}

Made by Arcoz with ❤️

1.0.1

11 months ago

1.0.0

11 months ago