Mercurial > pub > Impl
diff Lib/IMPL/Web/Handler/ErrorHandler.pm @ 353:feeb3bc4a818
corrected error handling while loading templates
corrected variables lookup in controls
updated handles to use the new view features
author | cin |
---|---|
date | Fri, 11 Oct 2013 15:49:04 +0400 |
parents | 32aceba4ee6d |
children | 69a1f1508696 |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/ErrorHandler.pm Thu Oct 10 19:51:19 2013 +0400 +++ b/Lib/IMPL/Web/Handler/ErrorHandler.pm Fri Oct 11 15:49:04 2013 +0400 @@ -17,7 +17,8 @@ }, props => [ errors => PROP_RW, - loader => PROP_RW, + view => PROP_RW, + layout => PROP_RW, fallback => PROP_RW, contentType => PROP_RW ] @@ -26,7 +27,7 @@ sub CTOR { my ($this) = @_; - die ArgumentException->new("loader") unless $this->loader; + die ArgumentException->new("view") unless $this->view; die ArgumentException->new("fallback") unless $this->fallback; $this->errors({}) unless $this->errors; @@ -44,7 +45,7 @@ if (my $err = $@) { - warn "$err"; + warn "error handler: $err"; my $vars = { error => $err @@ -58,12 +59,13 @@ my ($code) = ($status =~ m/^(\d+)/); - my $doc = $this->loader->document( - $this->errors->{$code} || $this->fallback, - $vars - ); - - my $text = $doc->Render($vars); + my $text = $this->view->display( + $err, + $this->errors->{$code} || $this->fallback, + { + layout => $this->layout + } + ); $result = HttpResponse->new( status => $status,