Lumen-framework: Exception rendering

Created on 19 Mar 2020  路  13Comments  路  Source: laravel/lumen-framework

  • Lumen Version: 7.0
  • Laravel Version: 7.0
  • PHP Version: 7.3.14
  • Database Driver & Version: mysqlnd 5.0.12

Description:

Exception rendering doesn't load a full html page.

Steps To Reproduce:

Throw an exception

\Exception\Handler->renderExceptionWithSymfony returns $renderer->getBody which does not return a full html page. It looks like a full page was returned by the exception handler up until version 6.

bug

All 13 comments

@GrahamCampbell do you know what's going on here?

I can take a look. @mblaney are you saying that it was working fine in Lumen 6, but not 7?

Yes only started happening after an update. Made a temporary fix by changing which Symfony template gets used.

I can't see anything wrong. The full error page gets returned?

curl http://localhost:8000/123
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="robots" content="noindex,nofollow,noarchive" />
    <title>An Error Occurred: Not Found</title>
    <style>body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
.container { margin: 30px; max-width: 600px; }
h1 { color: #dc3545; font-size: 24px; }
h2 { font-size: 18px; }</style>
</head>
<body>
<div class="container">
    <h1>Oops! An Error Occurred</h1>
    <h2>The server returned a "404 Not Found".</h2>

    <p>
        Something is broken. Please let us know what you were doing when this error occurred.
        We will fix it as soon as possible. Sorry for any inconvenience caused.
    </p>
</div>
</body>
</html>

Oh, you mean when debug=true is enabled. I can replicate this now.

Yeah errors are ok you need to throw an exception to render the stack trace.

Ah yeah that too.

That was a thrown exception. Error 404's are implemented by throwing an exception. ;)

Hmmm, did you have a specific fix in mind?

From what I can see, we are calling the same rendering code the symfony error handler calls?

AH, wait, I see...

awesome! thanks :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dunice picture dunice  路  3Comments

concept47 picture concept47  路  3Comments

timrogers picture timrogers  路  3Comments

patrikengborg picture patrikengborg  路  3Comments

gfazioli picture gfazioli  路  5Comments