Skip to content

Commit

Permalink
Item13424: Make string translation more robust.
Browse files Browse the repository at this point in the history
catch and report errors rather than crashing.   This appears to be a
perl error.  Perl 5.16.3 is know to crash,  5.18+ works fine.
  • Loading branch information
gac410 committed May 22, 2015
1 parent b579c69 commit 5cba582
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions core/lib/Foswiki/I18N.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package Foswiki::I18N;
use strict;
use warnings;
use Assert;
use Error qw(:try);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
Expand Down Expand Up @@ -269,9 +270,20 @@ sub maketext {
);
}

my $result = $this->SUPER::maketext( $text, @args );

return $result;
my $result = '';
try {
$result = $this->SUPER::maketext( $text, @args );
return $result;
}
catch Error with {
my $e = shift;
print STDERR
"#### Error: MAKETEXT - String translation failed for \"$text\". "
. $e->stringify()
if DEBUG;
return
"<span class='foswikiAlert'>ERROR: Translation failed, see server error log.</span>";
}
}

=begin TML
Expand Down

0 comments on commit 5cba582

Please sign in to comment.