Bug 32490 - When there's a broken spec, Mojolicious fails to capture the error properly
Summary: When there's a broken spec, Mojolicious fails to capture the error properly
Status: RESOLVED DUPLICATE of bug 33020
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on: 22678
Blocks:
  Show dependency treegraph
 
Reported: 2022-12-19 12:30 UTC by Martin Renvoize
Modified: 2023-02-23 00:31 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2022-12-19 12:30:59 UTC
At some point we broke mojolious's built in error processing code.

Instead of a useful stack track we now get a bunch of internal Mojo error code instead and nothing useful to point at the actual underlying problem.

>>
The application raised the following error:

  Can't use an undefined value as an ARRAY reference at template mojo/debug.html.ep line 288.
Context:
  283:               </div>
  284:               <div class="tap tap-border-top">tap for more</div>
  285:             </div>
  286:           </div>
  287:           <div class="row">
  288:             % if (@{app->log->history}) {
  289:                 % my $log = join '', map { scalar app->log->format->(@$_) } @{app->log->history};
  290:                 <pre class="mojo-terminal"><code class="nohighlight"><%= $log %></code></pre>
  291:             % }
  292:             % else {
  293:               <div class="alert alert-warning wide" role="alert">
Traceback (most recent call first):
  File "template mojo/debug.html.ep", line 288, in "Mojo::Template::Sandbox::6bff7bf20514502e6c04c41933771297"

. . . internal mojo stuff

  File "/usr/bin/starman", line 38, in "main"

and the StackTrace middleware couldn't catch its stack trace, possibly because your application overrides $SIG{__DIE__} by itself, preventing the middleware from working correctly. Remove the offending code or module that does it: known examples are CGI::Carp and Carp::Always.

For example

I traced this back a little in the server logs where it points to Koha::Logger not implimenting the 'history' method.
Comment 1 Martin Renvoize 2022-12-19 12:31:25 UTC
The current code on bug 29453 highlights this
Comment 2 Martin Renvoize 2022-12-19 14:30:38 UTC
(In reply to Martin Renvoize from comment #1)
> The current code on bug 29453 highlights this

Not any more it doesn't.. I used swagger-cli to validate and spot my issues.
Comment 3 Jonathan Druart 2023-02-22 09:29:01 UTC
I haven't seen this one before.

Wondering why it has been ignored for so long, it's a real pain for devs!

*** This bug has been marked as a duplicate of bug 33020 ***