/** * @param \Exception $exception * * @return bool */ public function onUncaughtException($exception) { for ($i = ob_get_level(); $i > 0; $i--) { ob_end_clean(); } $callers = []; foreach (explode("\n", $exception->getTraceAsString()) as $v) { $parts = explode(' ', $v, 2); $call = $parts[1]; if (!Text::contains($call, ':')) { $call .= ': '; } $parts = explode(': ', $call, 2); $callers[] = ['location' => $parts[0], 'revoke' => $parts[1]]; } $this->_exception = ['message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'callers' => $callers]; echo $this->output(); return true; }