alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r17719: Show error string in LJ::Error::DieObjec...

Committer: afedorov
Show error string in LJ::Error::DieObject
U   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'); }
 

Tags: livejournal, pm, red_alf
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments