Skip to content

Commit

Permalink
Missing types raise an exception, fix #107
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogamiz committed Aug 26, 2019
1 parent bb4eb3b commit cbddbd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/Type/Perl6/Documentable/Primary.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,17 @@ must follow the format:
=end code
=end pod

=begin pod :kind("type") :subkind("class") :category("exception")
=TITLE class X::Documentable::TypeNotFound
=SUBTITLE Missing type in type-graph file
X::Documentable::TypeNotFound is Exception {}
Attempt to create the typegraph representation of a missing type. To fix it, add that type
to the type-graph file you are using.
=end pod
10 changes: 9 additions & 1 deletion lib/Perl6/Documentable/DocPage/Primary.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ use URI::Escape;
use Pod::Utilities::Build;
use Perl6::Documentable;

class X::Documentable::TypeNotFound is Exception {
has $.type;
method message() {
"$.type entry not found in type-graph.txt file."
}
}

class Perl6::Documentable::DocPage::Primary::Language
does Perl6::Documentable::DocPage {

Expand Down Expand Up @@ -125,7 +132,8 @@ class Perl6::Documentable::DocPage::Primary::Type
#| Completes a type pod with inherited routines
method compose-type($registry, $doc) {

{return;} unless $registry.tg.types{$doc.name};
die X::Documentable::TypeNotFound.new(:type("$doc.name"))
unless $registry.tg.types{$doc.name};

$doc.pod.contents.append: self.typegraph-fragment($doc.name);

Expand Down

0 comments on commit cbddbd2

Please sign in to comment.