comparison Lib/IMPL/Web/Handler/ErrorHandler.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 47f77e6409f7
children 3cebcf6fdb9b
comparison
equal deleted inserted replaced
229:47f77e6409f7 230:6d8092d8ce1b
47 47
48 my $vars = { 48 my $vars = {
49 error => $err 49 error => $err
50 }; 50 };
51 51
52 my $code = 500; 52 my $status = "500 Internal Server Error";
53 53
54 if (eval { $err->isa(WebException) }) { 54 if (eval { $err->isa(WebException) }) {
55 ($code) = ($err->status =~ m/^(\d+)/); 55 $status = $err->status;
56 } 56 }
57
58 my ($code) = ($status =~ m/^(\d+)/);
57 59
58 my $doc = $this->loader->document( 60 my $doc = $this->loader->document(
59 $this->errors->{$code} || $this->fallback, 61 $this->errors->{$code} || $this->fallback,
60 $vars 62 $vars
61 ); 63 );
62 64
63 my $text = $doc->Render($vars); 65 my $text = $doc->Render($vars);
64 66
65 $result = HttpResponse->new( 67 $result = HttpResponse->new(
66 status => $err->status, 68 status => $status,
67 type => $this->contentType, 69 type => $this->contentType,
68 charset => 'utf-8', 70 charset => 'utf-8',
69 headers => $err->headers, 71 headers => eval{ $err->headers } || {},
70 body => $text 72 body => $text
71 ); 73 );
72 } 74 }
73 75
74 return $result; 76 return $result;