function ark_handle_exceptions($exception) { if (function_exists('log_message')) { $h = 'Exception of type \'' . get_class($exception) . '\' occurred with Message: ' . $exception->getMessage() . ' in File ' . $exception->getFile() . ' at Line ' . $exception->getLine(); $bt = $exception->getTraceAsString(); log_message('error', $h . "\nBacktrace:\n" . $bt, TRUE); } show_exception($exception); // mail('*****@*****.**', 'An Exception Occurred', $msg, 'From: test@example.com'); }
/** * Run a controller given the routing information */ protected function runController($routing) { $class = $routing['class']; $method = $routing['method']; $params = $routing['segments']; // set the legacy facade before instantiating $class::_setFacade($this->legacy->getFacade()); $this->legacy->markBenchmark('controller_execution_time_( ' . $class . ' / ' . $method . ' )_start'); // here we go! // Catch anything that might bubble up from inside our app try { $controller = new $class(); $result = call_user_func_array(array($controller, $method), $params); } catch (FileNotFound $ex) { $error_routing = $this->getErrorRouting(); if ($routing['class'] == $error_routing['class']) { die('Fatal: Error handler could not be found.'); } return $this->runController($error_routing); } catch (\Exception $ex) { show_exception($ex); } if (isset($result)) { ee('Response')->setBody($result); } $this->legacy->markBenchmark('controller_execution_time_( ' . $class . ' / ' . $method . ' )_end'); }