Committer: afedorov
Show error string in LJ::Error::DieObjectU trunk/cgi-bin/LJ/Error.pm
Modified: trunk/cgi-bin/LJ/Error.pm =================================================================== --- trunk/cgi-bin/LJ/Error.pm 2010-11-18 09:01:32 UTC (rev 17718) +++ trunk/cgi-bin/LJ/Error.pm 2010-11-18 10:04:35 UTC (rev 17719) @@ -288,6 +288,13 @@ # automatic type returned when something dies with a reference, but not # an LJ::Error package LJ::Error::DieObject; +use overload '""' => \&to_string; +sub to_string { + my $self = shift; + my $object = $self->field('object'); + return $object ? $object->die_string : ''; +} + sub fields { qw(object) } sub die_object { return $_[0]->field('object'); }