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

Crash if metadata cannot be retrieved #398

Merged
merged 3 commits into from
Oct 27, 2021

Conversation

evnu
Copy link
Member

@evnu evnu commented Oct 25, 2021

This PR fixes #394 by crashing if cargo metadata fails. Example error:

== Compilation error in file lib/binary_example.ex ==
** (RuntimeError) calling `cargo metadata` failed.

    (rustler 0.22.2) lib/rustler/compiler/config.ex:87: Rustler.Compiler.Config.external_resources/2
    (rustler 0.22.2) lib/rustler/compiler/config.ex:69: Rustler.Compiler.Config.build/1
    (rustler 0.22.2) lib/rustler/compiler.ex:9: Rustler.Compiler.compile_crate/2
    lib/binary_example.ex:2: (module)

@evnu evnu requested a review from a team October 25, 2021 07:38
@evnu
Copy link
Member Author

evnu commented Oct 25, 2021

bfbd9cf (badmatch) and 0976bd8 (raise) are two different ways to fix #394. Badmatch is shorter, but does not result in a nice error message, raising is longer but the error message is better. I think the latter is preferable here.

Copy link
Member

@hansihe hansihe left a comment

Choose a reason for hiding this comment

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

LGTM, raising is the correct behavior here

If no output is produced, `Output:` is misleading as the stack trace
will be right after it.
@evnu
Copy link
Member Author

evnu commented Oct 26, 2021

I changed the output format a little bit in c6492f6. Output: is misleading if no output is empty.

@evnu evnu merged commit 8f191dc into rusterlium:master Oct 27, 2021
@evnu evnu deleted the abort-on-metadata-error branch October 27, 2021 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad error handling in config
3 participants