Introduction to Zend Framework

 Learning Zend Framework

appendix

 Zend Framework Reference


  •  Zend_Gdata
  •  Zend_Http
  •  Zend_InfoCard
  •  Zend_Json
  •  Zend_Layout
  •  Zend_Ldap
  •  Zend_Loader
  •  Zend_Locale
  •  Zend_Log
  •  Zend_Mail
  •  Zend_Markup
  •  Zend_Measure
  •  Zend_Memory
  •  Zend_Mime
  •  Zend_Navigation
  •  Zend_Oauth
  •  Zend_OpenId
  •  Zend_Paginator
  •  Zend_Pdf
  •  Zend_ProgressBar
  •  Zend_Queue
  •  Zend_Reflection
  •  Zend_Registry
  •  Zend_Rest

  •  Zend_Search_Lucene
  •  Zend_Serializer
  •  Zend_Server
  •  Zend_Service
  •  Zend_Session
  •  Zend_Soap
  •  Zend_Tag
  •  Zend_Test
  •  Zend_Text
  •  Zend_TimeSync
  •  Zend_Tool
  •  Zend_Tool_Framework
  •  Zend_Tool_Project
  •  Zend_Translate
  •  Zend_Uri
  •  Zend_Validate
  •  Zend_Version
  •  Zend_View
  •  Zend_Wildfire
  •  Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Update 2011-11-16 - Revision 24438 - Version ZF 1.11.x

    Chapter 31. Zend_Exception

    31.1. Using Exceptions

    Zend_Exception is simply the base class for all exceptions thrown within Zend Framework.

    Example 31.1. Catching an Exception

    The following code listing demonstrates how to catch an exception thrown in a Zend Framework class:

    try {
        
    // Calling Zend_Loader::loadClass() with a non-existant class will cause
        // an exception to be thrown in Zend_Loader:
        
    Zend_Loader::loadClass('nonexistantclass');
    } catch (
    Zend_Exception $e) {
        echo 
    "Caught exception: " get_class($e) . "\n";
        echo 
    "Message: " $e->getMessage() . "\n";
        
    // Other code to recover from the error
    }

    Zend_Exception can be used as a catch-all exception class in a catch block to trap all exceptions thrown by Zend Framework classes. This can be useful when the program can not recover by catching a specific exception type.

    The documentation for each Zend Framework component and class will contain specific information on which methods throw exceptions, the circumstances that cause an exception to be thrown, and the various exception types that may be thrown.

    digg delicious meneame google twitter technorati facebook

    Comments

    Loading...