[Rt-devel] Errors generate warnings

Nicholas Clark nick at ccl4.org
Fri Jun 15 12:23:31 EDT 2007


html/Element/Errors generates uninitialized value warnings if the parameter
$Details is not passed in, and if the SessionType is undefined. The following
patch quietens it.

Nicholas Clark

Index: html/Elements/Error
===================================================================
RCS file: /export/cvsroot/rt-external/html/Elements/Error,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 Error
--- html/Elements/Error	21 May 2007 14:38:40 -0000	1.1.1.1
+++ html/Elements/Error	15 Jun 2007 16:17:14 -0000
@@ -49,7 +49,7 @@
 <div class="error">
 <%$Why%>
 <br />
-<%$Details%>
+<% defined $Details ? $Details : '' %>
 </div>
 
 <%cleanup>
@@ -65,7 +65,8 @@ $Why => loc("the calling component did n
 </%args>
 
 <%INIT>
-my $error = "WebRT: $Why ($Details)";
+my $error = "WebRT: $Why ";
+$error .= " ($Details)" if defined $Details;
 
 # TODO: Log::Dispatch isn't UTF-8 safe. Autrijus needs to talk to dave rolsky about getting this fixed
 if ($] >= 5.007001) {
@@ -75,10 +76,10 @@ if ($] >= 5.007001) {
 
 $RT::Logger->error($error);
 
-if ( $session{'SessionType'} eq 'REST' ) {
+if ( defined $session{'SessionType'} && $session{'SessionType'} eq 'REST' ) {
     $r->content_type('text/plain');
     $m->out( "Error: " . $Why . "\n" );
-    $m->out( $Details . "\n" );
+    $m->out( $Details . "\n" ) if defined $Details;
     $m->abort();
 }
 </%INIT>


More information about the Rt-devel mailing list