/** * Handles exception for user * * @access public * @static * * @param \Exception $exception * @param array $messages * * @return Response * @throws ServiceException */ public static function handleForUser(\Exception $exception, $messages = array()) { if ($exception == null) { $exception = new \Exception('Sorry for the inconvenience. We are working to resolve this issue. Thank you for your patience.'); } $renderer = new Renderer(Service::get('config')['error_500'], true); foreach ($messages as $message => $m) { $renderer->set($message, $m); } $content = $renderer->generatePage(); $response = new Response($content, array(), 500); $exception->saveExceptionLog(); return $response; }