Permalink
Browse files

Make object description in error also show the name of the object if …

…possible
  • Loading branch information...
lizmat committed Sep 23, 2013
1 parent 1791775 commit dbc827353b9e14347c82c4b69ce32380e2c495e3
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/core/Any.pm
View
@@ -362,19 +362,25 @@ sub RWPAIR(\k, \v) { # internal fast pair creation
p
}
+sub OBJECT_HUH (\SELF) {
+ my $huh = SELF.WHAT.perl;
+ try { $huh ~= " {SELF.VAR.name}" };
+ $huh;
+}
+
sub SLICE_HUH ( \SELF, @nogo, %a, %adv ) {
@nogo.unshift('delete') # recover any :delete if necessary
if @nogo && @nogo[0] ne 'delete' && %adv.exists('delete');
@nogo.push( %a<delete exists kv p k v>:delete:k ); # all valid params
if %a.elems {
%a.elems > 1
- ?? fail "{%a.elems} unexpected named parameters ({%a.keys.join(', ')}) passed to {SELF.WHAT.perl}"
- !! fail "Unexpected named parameter '{%a.keys}' passed to {SELF.WHAT.perl}";
+ ?? fail "{%a.elems} unexpected named parameters ({%a.keys.join(', ')}) passed to {OBJECT_HUH(SELF)}"
+ !! fail "Unexpected named parameter '{%a.keys}' passed to {OBJECT_HUH(SELF)}";
}
else {
- fail "Unsupported combination of named parameters ({@nogo.join(', ')}) passed to {SELF.WHAT.perl}";
+ fail "Unsupported combination of named parameters ({@nogo.join(', ')}) passed to {OBJECT_HUH(SELF)}";
}
} #SLICE_HUH

0 comments on commit dbc8273

Please sign in to comment.