Hi.
I’ve made a small console script which fetches information from a webservice call.
The client code is this:
try {
$client = new SoapClient(Yii::app()->params['webServiceURL']);
[...]
} catch (Exception $e) {
echo $e->getMessage ();
Yii::app()->end(1);
}
When I test it offline on my laptop, where the webServiceURL is not resolvable (host not found), I get the following console error
PHP Error[2]: SoapClient::SoapClient(): php_network_getaddresses: getaddrinfo failed: Name or service not known
in file /home/maxxer/work/hotspot-client-v2/internavigare/www/management_site/protected/commands/YnasconfigCommand.php at line 24
#0 /home/maxxer/work/hotspot-client-v2/internavigare/www/management_site/protected/commands/YnasconfigCommand.php(24): SoapClient->SoapClient()
#1 unknown(0): YNasConfigCommand->actionConfigura()
#2 /home/maxxer/work/hotspot-client-v2/internavigare/www/yii/framework/console/CConsoleCommand.php(141): ReflectionMethod->invokeArgs()
#3 /home/maxxer/work/hotspot-client-v2/internavigare/www/yii/framework/console/CConsoleCommandRunner.php(65): YNasConfigCommand->run()
#4 /home/maxxer/work/hotspot-client-v2/internavigare/www/yii/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run()
#5 /home/maxxer/work/hotspot-client-v2/internavigare/www/yii/framework/base/CApplication.php(162): CConsoleApplication->processRequest()
#6 /home/maxxer/work/hotspot-client-v2/internavigare/www/yii/framework/yiic.php(33): CConsoleApplication->run()
#7 /home/maxxer/work/hotspot-client-v2/internavigare/www/management_site/protected/yiic-maxxer.php(<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />: require_once()
but the exception is not caught!
Why? Shouldn’t “Exception” trap all of them?
thanks