Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 819d371660ffb2343d411ae9fa3613243aa57eba 1 parent c5d90d6
@lizmat lizmat authored
Showing with 22 additions and 8 deletions.
  1. +22 −8 src/vm/parrot/guts/bind.c
View
30 src/vm/parrot/guts/bind.c
@@ -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);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.