X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseAttribute.xs;h=617a99a6cbd17e9119c48d5a9778a96c5aba50bb;hb=c7576321a8f564428999a4d9dac5abf923a110a7;hp=f8012dabc3275d9c80a5b8597a1d31235dd74da4;hpb=d503a4f3aa9eda772309f6c99ccd4dfcdfed059d;p=gitmo%2FMouse.git diff --git a/xs-src/MouseAttribute.xs b/xs-src/MouseAttribute.xs index f8012da..617a99a 100644 --- a/xs-src/MouseAttribute.xs +++ b/xs-src/MouseAttribute.xs @@ -280,10 +280,7 @@ CODE: /* taken from Class::MOP::Attribute::new */ - if(!SvOK(name)){ - mouse_throw_error(klass, NULL, - "You must provide a name for the attribute"); - } + must_defined(name, "an attribute name"); svp = hv_fetchs(args, "init_arg", FALSE); if(!svp){ @@ -297,7 +294,7 @@ CODE: svp = hv_fetchs(args, "builder", FALSE); if(svp){ if(!SvOK(*svp)){ - mouse_throw_error(klass, NULL, + mouse_throw_error(klass, *svp, "builder must be a defined scalar value which is a method name"); } can_be_required = TRUE; @@ -305,7 +302,7 @@ CODE: } else if((svp = hv_fetchs(args, "default", FALSE))){ if(SvROK(*svp) && SvTYPE(SvRV(*svp)) != SVt_PVCV) { - mouse_throw_error(klass, NULL, + mouse_throw_error(klass, *svp, "References are not allowed as default values, you must " "wrap the default of '%"SVf"' in a CODE reference " "(ex: sub { [] } and not [])", name);