summaryrefslogtreecommitdiff
path: root/src/Exceptions/Handler.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-07 03:06:21 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-14 00:17:19 +0200
commit92c26718fd0799660515d64feabbbc1cd1d71a35 (patch)
tree6574a53688e1981aa524ef32ee203f2c6836d968 /src/Exceptions/Handler.php
parent864a086900b92233d7cf76747828163346eabc77 (diff)
exceptions: implemented error rendering return
Diffstat (limited to 'src/Exceptions/Handler.php')
-rw-r--r--src/Exceptions/Handler.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php
index ee15717a..0503b5b7 100644
--- a/src/Exceptions/Handler.php
+++ b/src/Exceptions/Handler.php
@@ -54,8 +54,10 @@ class Handler
/**
* @param Throwable $e
+ * @param bool $return
+ * @return string
*/
- public function exceptionHandler($e)
+ public function exceptionHandler($e, $return = false)
{
if (!$this->request instanceof Request) {
$this->request = new Request();
@@ -63,8 +65,19 @@ class Handler
$handler = $this->handler[$this->environment];
$handler->report($e);
+ ob_start();
$handler->render($this->request, $e);
+
+ if ($return) {
+ $output = ob_get_contents();
+ ob_end_clean();
+ return $output;
+ }
+
+ http_response_code(500);
+ ob_end_flush();
$this->die();
+ return '';
}
/**