Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise and reraise exceptions with Stdlib rather than Lwt #1079

Merged
merged 3 commits into from
Aug 30, 2024

Commits on Jul 22, 2024

  1. Configuration menu
    Copy the full SHA
    6aba61a View commit details
    Browse the repository at this point in the history
  2. Use failwith instead of Lwt.fail_with

    Lwt's documentation reads:
    
    > In most cases, it is better to use `failwith s` from the standard
    > library.
    
    and
    
    > Whenever possible, it is recommended to use `raise exn` instead, as
    > raise captures a backtrace, while `Lwt.fail` does not. If you call
    > `raise exn` in a callback that is expected by Lwt to return a
    > promise, Lwt will automatically wrap `exn` in a rejected promise,
    > but the backtrace will have been recorded by the OCaml runtime.
    >
    > For example, `bind`'s second argument is a callback which returns a
    > promise. And so it is recommended to use `raise` in the body of that
    > callback.
    >
    > Use `Lwt.fail` only when you specifically want to create a rejected
    > promise, to pass to another function, or store in a data structure.
    
    Prefer to capture backtraces to improve debugability.
    MisterDA committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    f0ddb83 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9b30a5d View commit details
    Browse the repository at this point in the history