Skip to content

Commit

Permalink
Propagate error code if between 400 and 600 for production sites (err…
Browse files Browse the repository at this point in the history
…ors:display = false or -1) (#2181)
  • Loading branch information
Perlkonig authored and rhukster committed Nov 12, 2018
1 parent d0b34d1 commit bf86b5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions system/src/Grav/Common/Errors/BareHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class BareHandler extends Handler
*/
public function handle()
{
$inspector = $this->getInspector();
$code = $inspector->getException()->getCode();
if ( ($code >= 400) && ($code < 600) )
{
$this->getRun()->sendHttpCode($code);
}

return Handler::QUIT;
}

Expand Down
4 changes: 4 additions & 0 deletions system/src/Grav/Common/Errors/SimplePageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function handle()
$cssFile = $this->getResource("error.css");

$code = $inspector->getException()->getCode();
if ( ($code >= 400) && ($code < 600) )
{
$this->getRun()->sendHttpCode($code);
}
$message = $inspector->getException()->getMessage();

if ($inspector->getException() instanceof \ErrorException) {
Expand Down

0 comments on commit bf86b5a

Please sign in to comment.