Rich Bitch Posted July 19, 2010 Report Share Posted July 19, 2010 Lapā ar zend framework palīdzību tiek attēloti dati no google kalendāra, bet ik pa laikam tiek izmests šāds error: Jul 18 10:51:37 web httpd[11624]: [error] [client 12.345.67.89] PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to tcp://www.google.com:80. Error #0: php_network_getaddresses: getaddrinfo failed: Name or service not known' in /home/www/xxx/Zend/Gdata/App.php:679\nStack trace:\n#0 /home/www/xxx/Zend/Gdata.php(221): [utt...] Kā ar šo problēmu varētu cīnīties un kā to varētu atrisināt? Quote Link to comment Share on other sites More sharing options...
briedis Posted July 19, 2010 Report Share Posted July 19, 2010 Izmantot try catch, noķerot šito exceptionu :) Quote Link to comment Share on other sites More sharing options...
Rich Bitch Posted July 19, 2010 Author Report Share Posted July 19, 2010 OOP nav mana stiprā puse, tāpēc varbūt varētu pateikt kā to izdarīt? Quote Link to comment Share on other sites More sharing options...
briedis Posted July 19, 2010 Report Share Posted July 19, 2010 Tak pameklē gūglē, ko nozīmē tas try catch. http://php.net/manual/en/language.exceptions.php Rekur vienkāršs paraugs - <?php function exceptionFunction() { throw new Exception("Throwing an exception!"); } try { exceptionFunction(); } catch (Exception $e) { echo "Exception caught!\n"; } ?> Quote Link to comment Share on other sites More sharing options...
Rich Bitch Posted July 19, 2010 Author Report Share Posted July 19, 2010 tik daudz es atradu, kā izveidot try catch, bet es nesaprotu kā var izveidot ar try catch, lai atrisinātu manu problēmu Quote Link to comment Share on other sites More sharing options...
briedis Posted July 19, 2010 Report Share Posted July 19, 2010 try { //Darbības, kas izsauc kļūdu } catch (Exception $e) { //Šis kods izpildīsies, ja tā try darbība nofeilos //Šeit, piemēram, vari paziņot lietotājam, ka pašlaik nevar dabūt to kalendāru } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.