[prev] [thread] [next] [Date index for 2005/06/07]
------=_Part_2103_22496801.1118177303537 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I recently spent 20 minutes tracking down a problem that turned out to be= =20 trying to define a has_a relationship on a column I had previously removed.= =20 This patch adds a more descriptive error message. It's trivial but it would= =20 have saved me some time last week. Drew --- HasA.pm.orig Tue Jun 7 16:43:02 2005 +++ HasA.pm <http://HasA.pm> Tue Jun 7 16:45:15 2005 @@ -9,8 +9,9 @@ my $proto =3D shift; my $class =3D shift; $class->_invalid_object_method('has_a()') if ref $class; - my $column =3D $class->find_column(+shift) - or return $class->_croak("has_a needs a valid column"); + my $requested_col =3D shift; + my $column =3D $class->find_column($requested_col) + or return $class->_croak("has_a needs a valid column - $requested_col doe= s=20 not exist"); my $a_class =3D shift or $class->_croak("$class $column needs an associated class"); my %meths =3D @_; --=20 ---------------------------------------------------------------- Drew Taylor * Web development & consulting Email: drew@xxxxxxxxxx.xxx * Site implementation & hosting Web : www.drewtaylor.com <http://www.drewtaylor.com> *=20 perl/mod_perl/DBI/mysql/postgres ---------------------------------------------------------------- ------=_Part_2103_22496801.1118177303537 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I recently spent 20 minutes tracking down a problem that turned out to be trying to define a has_a relationship on a column I had previously removed. This patch adds a more descriptive error message. It's trivial but it would have saved me some time last week.<br> <br> Drew<br> <br> --- HasA.pm.orig Tue Jun 7 = 16:43:02 2005<br> +++ <a href=3D"http://HasA.pm">HasA.pm</a> Tue Jun&= nbsp; 7 16:45:15 2005<br> @@ -9,8 +9,9 @@<br> my $proto =3D shift;<br> my $class =3D shift;<br> $class->_invalid_object_metho= d('has_a()') if ref $class;<br> - my $column =3D $class->find_column= (+shift)<br> - &n= bsp; or return $class->_croak("has_a needs a valid column");<br> + my $requested_col =3D shift;<br= > + my $column =3D $class->find_column= ($requested_col)<br> + &n= bsp; or return $class->_croak("has_a needs a valid column - $requested_col does not exist");<br> my $a_class =3D shift<br> &nb= sp; or $class->_croak("$class $column needs an associated class");= <br> my %meths =3D @_;<br> <br><br>-- <br>------------------------------------------------------------= ----<br> Drew Taylor &nb= sp; * Web development & consulting<br> Email: <a href=3D"mailto:= drew@xxxxxxxxxx.xxx">drew@xxxxxxxxxx.xxx</a> * Site i= mplementation & hosting<br> Web : <a href=3D"http://www.drew= taylor.com">www.drewtaylor.com</a> * perl/mod_perl/D= BI/mysql/postgres <br> ---------------------------------------------------------------- ------=_Part_2103_22496801.1118177303537--
[PATCH] Better error message for Relationship/HasA.pm
|
Re: [PATCH] Better error message for Relationship/HasA.pm
|
Generated at 16:36 on 28 Jul 2005 by mariachi v0.52