- Zend Framework - Working Example
- Zend Framework - Error Handling
- Zend Framework - Unit Testing
- Email Management
- Zend Framework - Authentication
- Session Management
- Cookie Management
- Zend Framework - Ajax
- Zend Framework - File Uploading
- Forms & Validation
- Different Databases
- Models & Database
- Zend Framework - Layout
- Zend Framework - View Layer
- Zend Framework - Routing
- Zend Framework - Controllers
- Zend Framework - Creating Module
- Application Structure
- Zend Framework - Module System
- Zend Framework - Event Manager
- Zend Framework - Service Manager
- Zend Framework - Concepts
- Zend Framework - MVC Architecture
- Skeleton Application
- Zend Framework - Installation
- Zend Framework - Introduction
- Zend Framework - Home
Zend Framework Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Zend Framework - Error Handpng
Failure of system needs to be handled effectively for the smooth running of the system. Zend Framework comes with a default error trapping that prints and logs the error as they occur. This same error handler is used to catch Exceptions.
The Error Handler displays errors when the debug is true and logs the error when the debug is false. Zend Framework has several exception classes and the built-in exception handpng will capture any uncaught exception and render a useful page.
Default Error Handpng
We can configure the default error settings in the apppcation configuration file, myapp/module/Apppcation/config/module.config.php.
The partial code sample is as follows −
view_manager => [ display_not_found_reason => true, display_exceptions => true, doctype => HTML5 , not_found_template => error/404 , exception_template => error/index , template_map => [ layout/layout => __DIR__ . /../view/layout/layout.phtml , apppcation/index/index => __DIR__ . /../view/apppcation/index/index.phtml , error/404 => __DIR__ . /../view/error/404.phtml , error/index => __DIR__ . /../view/error/index.phtml , ], template_path_stack => [ __DIR__ . /../view , ], ],
Here, the display_exception, not_found_template, exception_template, error/404 and the error/index are error related configuration items and are self-explanatory.
The most important item among these is the error/index. This is the template shown when an exception occurs in the system. We can modify this template, myapp/module/Apppcation/view/error/index.phtml to control the amount of error to be shown.
Advertisements