Skip to content

Commit

Permalink
Use path-spec instead of path for module-not-found errors
Browse files Browse the repository at this point in the history
The path portion of the path-spec is often not enough to debug
what wasn't found. This change includes the entire path-spec
when giving an error for e.g. `use NotFound;`
  • Loading branch information
ugexe committed Jan 30, 2019
1 parent c2e272e commit f770426
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/CompUnit/Repository.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ role CompUnit::Repository {
self.next-repo
?? self.next-repo.load($file)
!! nqp::die("Could not find $file in:\n"
~ $*REPO.repo-chain.map(*.Str).join("\n").indent(4));
~ $*REPO.repo-chain.map(*.path-spec).join("\n").indent(4));
}

# Returns the CompUnit objects describing all of the compilation
Expand Down
2 changes: 1 addition & 1 deletion src/core/CompUnit/Repository/AbsolutePath.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CompUnit::Repository::AbsolutePath does CompUnit::Repository {
}

return self.next-repo.load($file) if self.next-repo;
die("Could not find $file in:\n" ~ $*REPO.repo-chain.map(*.Str).join("\n").indent(4));
die("Could not find $file in:\n" ~ $*REPO.repo-chain.map(*.path-spec).join("\n").indent(4));
}

method loaded(--> Iterable:D) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Exception.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,7 @@ my class X::CompUnit::UnsatisfiedDependency is Exception {
is-core($name)
?? "{$name} is a builtin type, not an external module"
!! "Could not find $.specification at line $line in:\n"
~ $*REPO.repo-chain.map(*.Str).join("\n").indent(4)
~ $*REPO.repo-chain.map(*.path-spec).join("\n").indent(4)
~ ($.specification ~~ / $<name>=.+ '::from' $ /
?? "\n\nIf you meant to use the :from adverb, use"
~ " a single colon for it: $<name>:from<...>\n"
Expand Down

0 comments on commit f770426

Please sign in to comment.