problem

Package Version Hex Docs

An Error Handling library for Gleam. Inspired by https://github.com/lpil/snag but with your own error type.

Problem gives you:

gleam add problem

With this library you can add a stack to an error like:

    let result = Error("Invalid email")
    |> problem.wrap
    |> problem.context("when validating email")
    |> problem.context("in signup")

Then you can print the stack:

case result {
  Error(problem) -> {
    problem
    |> problem.pretty_print(function.identity)
    |> echo
  }
  _ -> {
    todo
  }
}
Invalid email

stack:
  when validating email
  in signup
Search Document