Skip to content

Commit

Permalink
Raise proper message on error
Browse files Browse the repository at this point in the history
  • Loading branch information
evnu committed Oct 25, 2021
1 parent bfbd9cf commit 0976bd8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rustler_mix/lib/rustler/compiler/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ defmodule Rustler.Compiler.Config do
defp external_resources(crate_path, crate) do
crate_str = to_string(crate)

{metadata, 0} =
System.cmd("cargo", ~w(metadata --format-version=1), cd: crate_path)
metadata =
case System.cmd("cargo", ~w(metadata --format-version=1), cd: crate_path) do
{metadata, 0} ->
metadata

{output, code} ->
raise "calling `cargo metadata` failed. Output:\n" <> output
end

json = Jason.decode!(metadata)

Expand Down

0 comments on commit 0976bd8

Please sign in to comment.