PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Handling Errors

Each Zend_Service_Technorati query method throws a Zend_Service_Technorati_Exception exception on failure with a meaningful error message.

There are several reasons that may cause a Zend_Service_Technorati query to fail. Zend_Service_Technorati validates all parameters for any query request. If a parameter is invalid or it contains an invalid value, a new Zend_Service_Technorati_Exception exception is thrown. Additionally, the Technorati API interface could be temporally unavailable, or it could return a response that is not well formed.

You should always wrap a Technorati query with a try ... catch block.

Example 851. Handling a Query Exception

<?php
$technorati 
= new Zend_Service_Technorati('VALID_API_KEY');
try {
    
$resultSet $technorati->search('PHP');
} catch(
Zend_Service_Technorati_Exception $e) {
    echo 
"An error occurred: " $e->getMessage();
}

Zend Framework