Exception: RbSys::CargoMetadataError

Inherits:
Error
  • Object
show all
Defined in:
lib/rb_sys/error.rb

Overview

Raised when Cargo metadata cannot be parsed.

Instance Method Summary collapse

Constructor Details

#initialize(err, stderr) ⇒ CargoMetadataError

Returns a new instance of CargoMetadataError.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rb_sys/error.rb', line 22

def initialize(err, stderr)
  msg = "    Could not infer Rust crate information using `cargo metadata`.\n\n    Original error was:\n      \#{err.class}: \#{err.message}\n\n    Things to check:\n      - Check that your ext/*/Cargo.toml at is valid\n      - If you are using a workspace, make sure you are the root Cargo.toml exists\n      - Make sure `cargo` is installed and in your PATH\n  MSG\n\n  if !stderr.empty?\n    indented_stderr = stderr.lines.map { |line| \"  \#{line}\" }.join\n    msg << \"Stderr from `cargo metadata` was:\\n\#{indented_stderr}\"\n  end\n\n  super(msg)\nend\n".chomp.tr("\n", " ")