Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #59 from Siddhant/nom
typed exception X::Hash::Store::OddNumber
  • Loading branch information
moritz committed Feb 28, 2012
2 parents 3ca6e5f + 584be63 commit 83b15cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/Exceptions.pm
Expand Up @@ -325,3 +325,7 @@ my class X::Routine::Unwrap is Exception {
my class X::Constructor::Positional is Exception {
method message() { "Default constructor only takes named arguments" }
}

my class X::Hash::Store::OddNumber is Exception {
method message() { "Odd number of elements found where hash expected" }
}
4 changes: 3 additions & 1 deletion src/core/Hash.pm
@@ -1,3 +1,5 @@
my class X::Hash::Store::OddNumber { ... }

my class Hash {
# Has attributes and parent EnumMap declared in BOOTSTRAP

Expand Down Expand Up @@ -44,7 +46,7 @@ my class Hash {
}
elsif $items { self.STORE_AT_KEY($x.Str, $items.shift) }
else {
die 'Odd number of elements found where hash expected'
die(X::Hash::Store::OddNumber.new())
}
}
self
Expand Down

0 comments on commit 83b15cd

Please sign in to comment.