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

fix(pkg): print depexts message when a program is not found #11005

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

moyodiallo
Copy link
Collaborator

Fixes #10988.

let _, loc = pkg in
let depexts_msg = if List.is_empty depexts then [] else Depexts.message depexts in
let error_msg = (Action.Prog.Not_found.message e).paragraphs in
raise (User_error.E (error_msg @ depexts_msg |> User_message.make ~loc))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be simpler to set the hint field of e. The benefit is that it would let us avoid adding new code to the engine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason to not use User_error.raise? I feel it makes the code easier to mentally parse.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion of @gridbugs was good one that simplifies the code.

Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg rgrinberg merged commit 9992794 into ocaml:main Oct 9, 2024
26 of 27 checks passed
@moyodiallo moyodiallo deleted the fix-for-depexts-bug branch October 15, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pkg: No depexts message when the command is not found.
4 participants