Permalink
Browse files

Make some lower level error message more understandable

Hash.pairs now says
  "Invocant requires an instance, but a type object was passed"
instead of:
  "Parameter '' requires an instance, but a type object was passed"
  • Loading branch information...
1 parent c5d90d6 commit 819d371660ffb2343d411ae9fa3613243aa57eba @lizmat lizmat committed Jul 20, 2013
Showing with 22 additions and 8 deletions.
  1. +22 −8 src/vm/parrot/guts/bind.c
View
@@ -466,17 +466,31 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
if (param->flags & SIG_ELEM_DEFINEDNES_CHECK) {
INTVAL defined = IS_CONCRETE(decont_value);
if (defined && param->flags & SIG_ELEM_UNDEFINED_ONLY) {
- if (error)
- *error = Parrot_sprintf_c(interp,
- "Parameter '%S' requires a type object, but an object instance was passed",
- param->variable_name);
+ if (error) {
+ if (param->flags & SIG_ELEM_INVOCANT) {
+ *error = Parrot_sprintf_c(interp,
+ "Invocant requires a type object, but an object instance was passed" );
+ }
+ else {
+ *error = Parrot_sprintf_c(interp,
+ "Parameter '%S' requires a type object, but an object instance was passed",
+ param->variable_name);
+ }
+ }
return junc_or_fail(interp, decont_value);
}
if (!defined && param->flags & SIG_ELEM_DEFINED_ONLY) {
- if (error)
- *error = Parrot_sprintf_c(interp,
- "Parameter '%S' requires an instance, but a type object was passed",
- param->variable_name);
+ if (error) {
+ if (param->flags & SIG_ELEM_INVOCANT) {
+ *error = Parrot_sprintf_c(interp,
+ "Invocant requires an instance, but a type object was passed" );
+ }
+ else {
+ *error = Parrot_sprintf_c(interp,
+ "Parameter '%S' requires an instance, but a type object was passed",
+ param->variable_name);
+ }
+ }
return junc_or_fail(interp, decont_value);
}
}

0 comments on commit 819d371

Please sign in to comment.