aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-10-09 11:38:32 +0100
committerMatthew Somerville <matthew@mysociety.org>2015-10-09 11:41:13 +0100
commit988c051193e621fad222aefe04c4f42c7571c3bd (patch)
tree533b328b8768ea23abc5256bfd83e78e69ddd8ca /perllib/FixMyStreet/App/View/Web.pm
parent92bfa42eac29c6db1b2fa34d6c29d0841f45e0cf (diff)
Prevent template errors from being logged twice.
Catalyst::View::TT calls both c->log->error and c->error; the former logs immediately, while the latter stashes the error, and then calls c->log->error with it during finalize.
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index 37a81e444..a92021f0c 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -11,7 +11,7 @@ use Utils;
__PACKAGE__->config(
TEMPLATE_EXTENSION => '.html',
- INCLUDE_PATH => [ #
+ INCLUDE_PATH => [
FixMyStreet->path_to( 'templates', 'web', 'base' ),
],
ENCODING => 'utf8',
@@ -38,6 +38,15 @@ TT View for FixMyStreet::App.
=cut
+# Override parent function so that errors are only logged once.
+sub _rendering_error {
+ my ($self, $c, $err) = @_;
+ my $error = qq/Couldn't render template "$err"/;
+ # $c->log->error($error);
+ $c->error($error);
+ return 0;
+}
+
=head2 loc
[% loc('Some text to localize', 'Optional comment for translator') %]