Documentation


SEARCH

TABLE OF CONTENT

    1. Getting started 2. Basic concepts 3. Request dispatching 4. Context container 5. Dual MVC 6. Component model: 7. Security 8. Configuration 9. Session handling 10. I18n 11. Cache 12. Logging 13. Error handling 14. Advanced Topics 15. API reference

      Tutorials: Frequently Asqued Questions

      See also:


      Exception management system

      Handling exception

      Table of Contents

      Introduction

      All exceptions that are not catched by your code are handled by the __ErrorHandler class.

      Once the __ErrorHandler receives an exception, it perform the following operations:

      • Logs the exception (if applicable by settings in the lion.ini file)
      • Executes a logic associated to the type of exception (just for exceptions subclassing the __LionException)
      • Shows a page with information regarding the exception

      Exception model in lion is already integrated with the I18n framework, allowing to define internationalized message

      Exception can be declared in xml configuration files and grouped by their semantic (i.e. security exception, configuration exceptions, rendering exceptions and so on).

      Last but not the least, the class in charge of rendering the page showing the exception can be customized.

      Runtime settings

      Lion has some runtime settings regarding how to handle exceptions (defined in /app/lion.ini):

      1. ...
      2.  
      3. ;Set as no for production environment
      4. DEBUG_MODE yes
      5.  
      6. ;Recommended to set as no for production environment
      7. DISPLAY_EXCEPTIONS yes
      8. DISPLAY_DEBUG_INFO yes
      9.  
      10. ...
      11.  
      12. ;-------------------------------------
      13. LOGGING DIRECTIVES:
      14. ;-------------------------------------
      15. LOG_ENABLED yes
      16. ;log uncatched exceptions:
      17. LOG_EXCEPTIONS yes
      18. ;log additional debug information when exceptions are uncatched:
      19. LOG_DEBUG_INFO yes
      20.  
      21. ...

      Being:

      • DEBUG_MODE: If debug mode is set to false, the trace of the exception won't be shown in the screen.
      • DISPLAY_EXCEPTIONS: This setting allow to show the concrete exception message. Otherwise a general message will be shown for every exception.
      • DISPLAY_DEBUG_INFO: This setting allow to show the trace when an exception comes. Note that this setting works just in debug mode. Otherwise it's ignored by Lion.
      • LOG_ENABLED: This setting enable the logging. We may turn on this setting in order to also log exceptions.
      • LOG_EXCEPTIONS: This setting forces to log every exception. Note that this setting works just if logging is enabled.
      • LOG_DEBUG_INFO: This setting log the trace and complementary debug information when an exception is raised. Note that this setting works just if logging is enabled.

      The __LionException class

      Lion has his own exception hierarchy subclassing the abstract exception class __LionException.
      However, Lion does not require to subclass the __LionException by our own exceptions.

      Lion error handling system

      The error handler brings some advantages:

      1. It decouples the usage of a concrete exception class or the other one from our logic, making it transparent to our application. See The Error Table.
      2. It eases the internationalization of our exception messages. See Exceptions and I18n.
      3. It eases the maintenance of all our exceptions within a single place as well as the assignment of error codes
      4. It eases how exceptions are shown to the user in an error page. See The Error Page.