mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.66k stars 576 forks source link

fix error reporting when loading applications with compile errors #2111

Closed haarg closed 9 months ago

haarg commented 9 months ago

When switching from loading an application from using require to using do, the error was still trying to be captured after a surrounding eval. This error would always be empty, because the error from the do was not rethrown. It would still result in an undef application, so an error would be thrown, but it would not include the actual compile error.

Change the do call inside the eval to throw an error if no application is returned. The error is then recaught outside the eval. Also add a test that shows that the real compilation error is included in the output.

Fixes #2110

daleif commented 9 months ago

Works fine in my morbo non-lite test.