Skip to content
Permalink
Browse files

Use path-spec instead of path for module-not-found errors

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 f7704267de473ebfe7b6f694f2403080945531df
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/core/CompUnit/Repository.pm6
  2. +1 −1 src/core/CompUnit/Repository/AbsolutePath.pm6
  3. +1 −1 src/core/Exception.pm6
@@ -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
@@ -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) {
@@ -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"

0 comments on commit f770426

Please sign in to comment.
You can’t perform that action at this time.