From 25e434bce4986b48bd72729a55aa1096e5a76be3 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 24 Nov 2017 15:08:43 +0100 Subject: Refactored ExceptionHandler --- src/Exceptions/Handlers/Legacy.php | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/Exceptions/Handlers/Legacy.php (limited to 'src/Exceptions/Handlers/Legacy.php') diff --git a/src/Exceptions/Handlers/Legacy.php b/src/Exceptions/Handlers/Legacy.php new file mode 100644 index 00000000..39683f72 --- /dev/null +++ b/src/Exceptions/Handlers/Legacy.php @@ -0,0 +1,42 @@ +unexpected error occurred, a team of untrained monkeys has been dispatched to deal with it.'; + } + + /** + * @param Throwable $e + */ + public function report(Throwable $e) + { + error_log(sprintf('Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s', + $e->getCode(), + $e->getMessage(), + $this->stripBasePath($e->getFile()), + $e->getLine(), + json_encode($e->getTrace()) + )); + } + + /** + * @param string $path + * @return string + */ + protected function stripBasePath($path) + { + $basePath = realpath(__DIR__ . '/../../..') . '/'; + return str_replace($basePath, '', $path); + } +} -- cgit v1.2.3-54-g00ecf