Skip to content

Commit c694749

Browse files
committed
fix showing Catalyst error pages on missing source files
Show now the not found page rather than an internal error page if a source file is not found. We could throw to an internal error page on 500 errors, but that seems excessive, and 404 will be accurate for some of those cases anyway. Checking the code is necessary because some url forms will generate internal errors from the back end, which won't be able to be decoded, resulting in errors and warning. One example of this is /source/<%meta.name%>/<%meta.other%>
1 parent 1fbf565 commit c694749

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/MetaCPAN/Web/Controller/Source.pm

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ sub index : Path : Args {
2626
$c->model('API::Module')->get(@module),
2727
);
2828
}
29-
die "Bad module supplied\n"
29+
30+
$c->detach('/not_found')
3031
if grep +( $_->{code} || 0 ) > 399, $source, $module;
32+
3133
if ( $module->{directory} ) {
3234
my $files = $c->model('API::File')->dir(@module)->get;
3335

log4perl_prod.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
log4perl.rootLogger=WARN, OUTPUT, SYSLOG
22

33
log4perl.filter.WarningsFilter = Log::Log4perl::Filter::StringMatch
4-
log4perl.filter.WarningsFilter.StringToMatch = failed to writev: -1 errno:32|Timed out at|does not map to Unicode|Bad module supplied
4+
log4perl.filter.WarningsFilter.StringToMatch = failed to writev: -1 errno:32|Timed out at|does not map to Unicode
55
log4perl.filter.WarningsFilter.AcceptOnMatch = false
66

77
log4perl.appender.OUTPUT = Log::Log4perl::Appender::Screen

0 commit comments

Comments
 (0)