Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'marcusramberg/master'

  • Loading branch information...
commit 1e7dc3044b9bd22df2916ce4ea4b6bc266c2f78f 2 parents 0708cfd + 01b8f94
@abh abh authored
Showing with 9 additions and 12 deletions.
  1. +5 −8 lib/MojoX/Renderer/TT.pm
  2. +4 −4 t/lite_app.t
View
13 lib/MojoX/Renderer/TT.pm
@@ -52,11 +52,12 @@ sub _init {
return $self;
}
+use Data::Dumper;
sub _render {
my ($self, $renderer, $c, $output, $options) = @_;
# Inline
- my $inline = $c->{stash}->{inline};
+ my $inline = $options->{inline};
# Template
my $t = $renderer->template_name($options);
@@ -77,14 +78,10 @@ sub _render {
# Error
unless ($ok) {
- my $e = $self->tt->error;
-
- if ($e =~ m/not found/) {
- $c->app->log->error(qq/Template "$t" missing or not readable./);
- $c->render_not_found;
- return;
- }
+ my $e = Mojo::Exception->new(
+ $self->tt->error.'',
+ $self->tt->service->process(defined $inline ? \$inline : $path));
$$output = '';
$c->app->log->error(qq/Template error in "$t": $e/);
$c->render_exception($e);
View
8 t/lite_app.t
@@ -34,7 +34,7 @@ get '/unknown_helper' => 'unknown_helper';
get '/on-disk' => 'foo';
-get '/foo/:message' => 'index';
+get '/bar/:message' => 'bar';
get '/inline' => sub { shift->render(inline => '[% 1 + 1 %]', handler => 'tt') };
@@ -44,7 +44,7 @@ my $t = Test::Mojo->new;
$t->get_ok('/exception')->status_is(500)->content_like(qr/error/i);
# Normal rendering
-$t->get_ok('/foo/hello')->content_is("hello");
+$t->get_ok('/bar/hello')->content_is("hello");
# With include
$t->get_ok('/with_include')->content_is("HelloInclude!Hallo");
@@ -56,7 +56,7 @@ $t->get_ok('/with_wrapper')->content_is("wrapped");
#$t->get_ok('/with_auto_wrapper')->content_is("wrapped");
# Unicode
-$t->get_ok('/unicode')->content_is(b("привет")->encode('UTF-8')->to_string);
+$t->get_ok('/unicode')->content_is("привет");
# Helpers
$t->get_ok('/helpers')->content_is("/helpers");
@@ -75,7 +75,7 @@ $t->get_ok('/inline')->status_is(200)->content_is('2');
__DATA__
-@@ index.html.tt
+@@ bar.html.tt
[% message %]
@@ error.html.tt
Please sign in to comment.
Something went wrong with that request. Please try again.