{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zf2/issues/7573","labels_url":"https://api.github.com/repos/zendframework/zf2/issues/7573/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zf2/issues/7573/comments","events_url":"https://api.github.com/repos/zendframework/zf2/issues/7573/events","html_url":"https://github.com/zendframework/zf2/issues/7573","id":85232270,"number":7573,"title":"Uncaught db connection exception","user":{"login":"googlle","id":2455916,"avatar_url":"https://avatars.githubusercontent.com/u/2455916?v=3","gravatar_id":"","url":"https://api.github.com/users/googlle","html_url":"https://github.com/googlle","followers_url":"https://api.github.com/users/googlle/followers","following_url":"https://api.github.com/users/googlle/following{/other_user}","gists_url":"https://api.github.com/users/googlle/gists{/gist_id}","starred_url":"https://api.github.com/users/googlle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlle/subscriptions","organizations_url":"https://api.github.com/users/googlle/orgs","repos_url":"https://api.github.com/users/googlle/repos","events_url":"https://api.github.com/users/googlle/events{/privacy}","received_events_url":"https://api.github.com/users/googlle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-04T19:03:51Z","updated_at":"2015-06-05T06:32:14Z","closed_at":null,"body":"Hi. Can't catch db connection error.\r\n```php\r\n//I use this code in index.php\r\ntry {\r\n\t// Run the application!\r\n\tZend\\Mvc\\Application::init(require 'config/application.config.php')->run();\r\n}\r\ncatch(\\Exception $exception) {\r\n\texit($exception->getMessage());\r\n}\r\n\r\n//When the mysql server is not responding, it shows this error\r\nError message:\r\nConnect Error: SQLSTATE[HY000] [2002].\r\n\r\nFatal error: Zend\\Db\\Adapter\\Exception\\RuntimeException:  \r\nConnect Error: SQLSTATE[HY000] [2002]. in \r\nC:\\xampp\\htdocs\\zf2\\vendor\\zendframework\\zendframework\\library\\Zend\\View\\Helper\\Navigation\\AbstractHelper.php on line 170\r\n```"},"comment":{"url":"https://api.github.com/repos/zendframework/zf2/issues/comments/109175878","html_url":"https://github.com/zendframework/zf2/issues/7573#issuecomment-109175878","issue_url":"https://api.github.com/repos/zendframework/zf2/issues/7573","id":109175878,"user":{"login":"googlle","id":2455916,"avatar_url":"https://avatars.githubusercontent.com/u/2455916?v=3","gravatar_id":"","url":"https://api.github.com/users/googlle","html_url":"https://github.com/googlle","followers_url":"https://api.github.com/users/googlle/followers","following_url":"https://api.github.com/users/googlle/following{/other_user}","gists_url":"https://api.github.com/users/googlle/gists{/gist_id}","starred_url":"https://api.github.com/users/googlle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlle/subscriptions","organizations_url":"https://api.github.com/users/googlle/orgs","repos_url":"https://api.github.com/users/googlle/repos","events_url":"https://api.github.com/users/googlle/events{/privacy}","received_events_url":"https://api.github.com/users/googlle/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T06:32:14Z","updated_at":"2015-06-05T06:32:14Z","body":"I found the cause of the error.\r\nI call in the layout ViewHelper getName ()\r\n\r\n```php\r\npublic function getViewHelperConfig()\r\n{\r\n\treturn array(\r\n\t\t'invokables' => array(\r\n\t\t\t'name' => 'Account\\View\\Helper\\Name',\r\n\t\t),\r\n\t);\r\n}\r\n\r\nclass Name extends AbstractHelper implements ServiceLocatorAwareInterface\r\n{\r\n\t/.../\r\n    public function __invoke()\r\n    {\r\n        $helperPluginManager = $this->getServiceLocator();\r\n        $serviceManager = $helperPluginManager->getServiceLocator();\r\n\r\n        $entityManager = $serviceManager->get('Account\\Entity\\AccountMapper');\r\n        $account = $entityManager->getName();\r\n\r\n        if (!$account) {\r\n            return null;\r\n        }\r\n\r\n        $output = sprintf(\"%s %s\", $account->getFirstName(), $account->getLastName());\r\n        return $output;\r\n    }\r\n}\r\n\r\nFatal error: Zend\\Db\\Adapter\\Exception\\RuntimeException: Connect Error: SQLSTATE[HY000] [2002] ... in C:\\xampp\\htdocs\\zf2\\vendor\\zendframework\\zendframework\\library\\Zend\\View\\Helper\\Navigation\\AbstractHelper.php on line 170\r\n```\r\nZF2 not catch this error.\r\nHow to catch?"}}