[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-95-gbc9d89e

Kevin Falcone falcone at bestpractical.com
Wed Jan 13 13:06:55 EST 2010


The branch, 3.8-trunk has been updated
       via  bc9d89e9af510ebc274e633bf569de0250878319 (commit)
      from  ce8a0fc98d2a69246fb7cf30e1763afe9d1cdace (commit)

Summary of changes:
 share/html/Helpers/CalPopup.html |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit bc9d89e9af510ebc274e633bf569de0250878319
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jan 13 13:05:36 2010 -0500

    Calendar::Simple would just Carp::croak on bad input
    
    Trap that, overriding RT's die handler so we can give users a friendly
    error message

diff --git a/share/html/Helpers/CalPopup.html b/share/html/Helpers/CalPopup.html
index 96e8d77..70b43c1 100644
--- a/share/html/Helpers/CalPopup.html
+++ b/share/html/Helpers/CalPopup.html
@@ -123,7 +123,17 @@ elsif ($DisplayedMonth == 1) {
     $prev_year--;
 }
 
-my @cal = calendar($DisplayedMonth, $DisplayedYear);
+my @cal;
+{
+    my $error;
+    # RT defines a __DIE__ and Calendar::Simple uses Carp::Croak to report errors
+    # work around this so we get a better error message if something is out of range
+    eval { local $SIG{__DIE__} = sub { $error = $_[0] }; @cal = calendar($DisplayedMonth, $DisplayedYear) };
+    if ($error) {
+        $RT::Logger->error("error $error");
+        $m->comp('/Elements/Error', Why => $error );
+    }
+}
 </%init>
 
 <%args>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list