Bug 34478: Display programming errors in case plack.psgi caught something suspicious
It will help developpers to debug the problematic places. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
1f081b86b6
commit
918fbc24f7
3 changed files with 14 additions and 1 deletions
|
@ -477,6 +477,14 @@ sub get_template_and_user {
|
|||
OPACBaseURL => C4::Context->preference('OPACBaseURL'),
|
||||
minPasswordLength => $minPasswordLength,
|
||||
);
|
||||
if ( C4::Context->config('dev_install') ) {
|
||||
# Dealing with debug_programming_error ( set from plack.psgi)
|
||||
$template->param(
|
||||
dev_install => 1,
|
||||
debug_programming_error => scalar $in->{query}->param('debug_programming_error'),
|
||||
);
|
||||
$in->{query}->delete('debug_programming_error');
|
||||
}
|
||||
if ( $in->{'type'} eq "intranet" ) {
|
||||
|
||||
$template->param(
|
||||
|
|
4
debian/templates/plack.psgi
vendored
4
debian/templates/plack.psgi
vendored
|
@ -51,11 +51,13 @@ use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise
|
|||
my $original_op = $q->param('op');
|
||||
my $request_method = $q->request_method // q{};
|
||||
if ( $request_method eq 'GET' && defined $original_op && $original_op =~ m{^cud-} ) {
|
||||
warn "Programming error - op '$original_op' must not start with 'cud-' with GET";
|
||||
warn "Programming error - op '$original_op' must not start with 'cud-' for GET";
|
||||
$q->param( 'op', '' );
|
||||
$q->param( 'debug_programming_error', "'$original_op' must not start with 'cud-' for GET" );
|
||||
} elsif ( $request_method ne 'GET' && defined $q->param('op') && $original_op !~ m{^cud-} ) {
|
||||
warn "Programming error - op '$original_op' must start with 'cud-' for $request_method";
|
||||
$q->param( 'op', '' );
|
||||
$q->param( 'debug_programming_error', "'$original_op' must start with 'cud-' for $request_method" );
|
||||
}
|
||||
|
||||
return $q;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
[% INCLUDE 'blocking_errors.inc' %]
|
||||
[% IF dev_install && debug_programming_error %]
|
||||
<div class="dialog alert">Programming error: [% debug_programming_error %]</div>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue