View | Details | Raw Unified | Return to bug 27557
Collapse All | Expand All

(-)a/debian/templates/plack.psgi (+1 lines)
Lines 108-113 builder { Link Here
108
        #NOTE: Without this middleware to catch fatal errors, ErrorDocument won't be able to render a 500 document
108
        #NOTE: Without this middleware to catch fatal errors, ErrorDocument won't be able to render a 500 document
109
        #NOTE: This middleware must be closer to the PSGI app than ErrorDocument
109
        #NOTE: This middleware must be closer to the PSGI app than ErrorDocument
110
        enable "HTTPExceptions";
110
        enable "HTTPExceptions";
111
        enable "StackTrace", no_print_errors => 1;
111
        if ( Log::Log4perl->get_logger('plack-intranet')->has_appenders ){
112
        if ( Log::Log4perl->get_logger('plack-intranet')->has_appenders ){
112
            enable 'Log4perl', category => 'plack-intranet';
113
            enable 'Log4perl', category => 'plack-intranet';
113
            enable 'LogWarn';
114
            enable 'LogWarn';
(-)a/errors/500.pl (+5 lines)
Lines 38-43 $template->param ( Link Here
38
    admin => $admin,
38
    admin => $admin,
39
    errno => 500,
39
    errno => 500,
40
);
40
);
41
if ( C4::Context->preference('DumpStacktraceOn500') && C4::Context->IsSuperLibrarian ) {
42
    $template->param(
43
        stacktrace => $ENV{'plack.stacktrace.text'},
44
    );
45
}
41
my $status = '500 Internal Server Error';
46
my $status = '500 Internal Server Error';
42
if ( C4::Auth::psgi_env() ) {
47
if ( C4::Auth::psgi_env() ) {
43
    $status = '200 OK';
48
    $status = '200 OK';
(-)a/installer/data/mysql/atomicupdate/bug_27557.perl (+12 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    $dbh->do(q|
5
        INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
6
        VALUES ('DumpStacktraceOn500','0', 'Display the error on 500 for superlibrarians.', 'YesNo')
7
    |);
8
9
10
    # Always end with this (adjust the bug info)
11
    NewVersion( $DBversion, 27557, "Add new syspref DumpStacktraceOn500");
12
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref (+6 lines)
Lines 110-112 Logging: Link Here
110
                  1: Do
110
                  1: Do
111
                  0: "Don't"
111
                  0: "Don't"
112
            - dump search query as a template parameter, requires <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=DumpTemplateVars">DumpTemplateVars</a>[interface] to be visible.
112
            - dump search query as a template parameter, requires <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=DumpTemplateVars">DumpTemplateVars</a>[interface] to be visible.
113
        -
114
            - pref: DumpStacktraceOn500
115
              choices:
116
                  1: Do
117
                  0: "Don't"
118
            - display a stacktrace of the error on 500 for superlibrarians.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/errorpage.tt (-1 / +19 lines)
Lines 1-3 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Error [% errno | html %]</title>
3
<title>Koha &rsaquo; Error [% errno | html %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 22-27 Link Here
22
            <li>You tried to access a page that needs authentication</li>
23
            <li>You tried to access a page that needs authentication</li>
23
            <li>An internal link in the client is broken and the page does not exist</li>
24
            <li>An internal link in the client is broken and the page does not exist</li>
24
        </ul>
25
        </ul>
26
        [% IF stacktrace %]
27
            <h3>Detail of the error <span id="show_error"><a href="#">[show]</a></span><span id="hide_error" style="display: none;"><a href="#">[hide]</a></span></h3>
28
            <div id="stacktrace" style="display: none;"><pre>[% stacktrace %]</pre></div>
29
        [% END %]
25
        <h3>What's next?</h3>
30
        <h3>What's next?</h3>
26
        <ul style="margin-bottom: 1em; padding-bottom: 1em; border-bottom: 1px solid #CCC;">
31
        <ul style="margin-bottom: 1em; padding-bottom: 1em; border-bottom: 1px solid #CCC;">
27
            <li>Use top menu bar to navigate to another part of Koha.</li>
32
            <li>Use top menu bar to navigate to another part of Koha.</li>
Lines 31-34 Link Here
31
            </div> <!-- /.col-md-8 -->
36
            </div> <!-- /.col-md-8 -->
32
        </div> <!-- /.row -->
37
        </div> <!-- /.row -->
33
38
39
    </div> <!-- /.container-fluid -->
40
41
[% MACRO jsinclude BLOCK %]
42
    <script>
43
        $(document).ready(function(){
44
            $("#show_error a, #hide_error a").on("click", function(e){
45
                e.preventDefault();
46
                $("#show_error").toggle();
47
                $("#hide_error").toggle();
48
                $("#stacktrace").toggle();
49
            });
50
        });
51
    </script>
52
[% END %]
34
[% INCLUDE 'intranet-bottom.inc' %]
53
[% INCLUDE 'intranet-bottom.inc' %]
35
- 

Return to bug 27557