-
Notifications
You must be signed in to change notification settings - Fork 74
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
.
#430
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
changed the title
Raise and reraise exceptions with
Raise and reraise exceptions with Jul 22, 2024
Stdlib
rather that Lwt
.Stdlib
rather than Lwt
.
Thanks for your contribution. I merged the main branch into your PR, and will merge this now. |
hannesm
added a commit
to hannesm/opam-repository
that referenced
this pull request
Aug 29, 2024
CHANGES: * adapt to TLS 1.0.0 API changes, bump OCaml lower bound to 4.13 (mirage/ocaml-conduit#432 @hannesm) * conduit-lwt-unix: improve the no TLS error message (mirage/ocaml-conduit#431 @filipeom) * Remove 4.12 CI runners, add 5.2 (mirage/ocaml-conduit#433 @art-w) * Update GitHub actions (mirage/ocaml-conduit#429 @smorimoto) * use failwith instead of Lwt.fail_with, use Lwt.reraise (mirage/ocaml-conduit#430 @MisterDA) * switch to sexplib0 instead of sexplib for lighter dependencies (mirage/ocaml-conduit#427 @emillon)
hannesm
added a commit
to hannesm/opam-repository
that referenced
this pull request
Aug 30, 2024
CHANGES: * adapt to TLS 1.0.0 API changes, bump OCaml lower bound to 4.13 (mirage/ocaml-conduit#432 @hannesm) * conduit-lwt-unix: improve the no TLS error message (mirage/ocaml-conduit#431 @filipeom) * Remove 4.12 CI runners, add 5.2 (mirage/ocaml-conduit#433 @art-w) * Update GitHub actions (mirage/ocaml-conduit#429 @smorimoto) * use failwith instead of Lwt.fail_with, use Lwt.reraise (mirage/ocaml-conduit#430 @MisterDA) * switch to sexplib0 instead of sexplib for lighter dependencies (mirage/ocaml-conduit#427 @emillon)
avsm
pushed a commit
to avsm/opam-repository
that referenced
this pull request
Sep 5, 2024
CHANGES: * adapt to TLS 1.0.0 API changes, bump OCaml lower bound to 4.13 (mirage/ocaml-conduit#432 @hannesm) * conduit-lwt-unix: improve the no TLS error message (mirage/ocaml-conduit#431 @filipeom) * Remove 4.12 CI runners, add 5.2 (mirage/ocaml-conduit#433 @art-w) * Update GitHub actions (mirage/ocaml-conduit#429 @smorimoto) * use failwith instead of Lwt.fail_with, use Lwt.reraise (mirage/ocaml-conduit#430 @MisterDA) * switch to sexplib0 instead of sexplib for lighter dependencies (mirage/ocaml-conduit#427 @emillon)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lwt's documentation reads:
and
Prefer to capture backtraces to improve debugability.
See also More raise less fail #1008.