-
Notifications
You must be signed in to change notification settings - Fork 97
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
Don't exit in library code #400
Merged
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
For Compile, Html_fragment and Odoc_html
Julow
commented
Dec 3, 2019
let resolve = Resolve.resolve | ||
let resolve resolver unit = | ||
try Ok (Resolve.resolve resolver unit) | ||
with Fetch_failed (`Msg _ as e) -> Error e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use an exception to propagate errors inside the resolver. This is to avoid a giant refactor and potentially making it slower.
Thanks! |
jonludlam
added a commit
to jonludlam/opam-repository
that referenced
this pull request
Feb 7, 2020
CHANGES: Additions - Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon) Bugs fixed - Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin) - Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam) - Refactor error reporting to avoid exiting the program in library code (ocaml/odoc#400, Jules Aguillon) - Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
mgree
pushed a commit
to mgree/opam-repository
that referenced
this pull request
Feb 19, 2020
CHANGES: Additions - Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon) Bugs fixed - Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin) - Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam) - Refactor error reporting to avoid exiting the program in library code (ocaml/odoc#400, Jules Aguillon) - Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
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.
Refactor error reporting to avoid exiting the program in library code.
Errors are propagated back to
odoc/bin/main.ml
by value and handled in an unified way.Most of the changes are trivial but the patch is very invasive, exiting functions were very deep in the program.
Using exceptions can make the patch a little smaller but also harder as all exposed functions would need to catch them and there is a lot of them.
The exit status for some errors (marshalling) is now
1
instead of2
. Is that an issue ?I added the
Or_error
module that re-exportresult
and define a bind operator. I didn't userresult
as it was removed in #306.Only the first commit is required for #398