This repository was archived by the owner on Dec 8, 2022. It is now read-only.
forked from mako-framework/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started: Error handling
Marco Montalbano edited this page Jul 31, 2017
·
1 revision
Mako converts all errors to ErrorExceptions. This allows the error handler to display a error page that contains a lot more information than the standard PHP error pages when something bad happens. The default error handler will also log the error if error logging is enabled.
You can register custom error handlers for different kinds of exception types using the ErrorHandler::handle() method.
ErrorHandler::handle('\PDOException', function($exception)
{
// Do some custom logging here
});
Your error handler should not have a return value unless you want it to stop further error handling.
ErrorHandler::handle('\Exception', function($exception)
{
// Do something else here
});
ErrorHandler::handle('\PDOException', function($exception)
{
// Do some custom logging here
});
You can register multiple error handlers for any type of error. Note that the last one registered is the first one to get executed.
- Getting started: Installation
- Getting started: Configuration
- Getting started: Error handling
- Getting started: Constants
- Getting started: Coding standards
- Controllers: Controllers
- Controllers: Request
- Controllers: Response
- Databases: Basics
- Databases: Query builder
- Databases: Orm
- Databases: Migrations
- Command line: Basics
- Command line: Custom tasks
- Packages: Basics
- Packages: Composer packages
- Learn more: Array helper
- Learn more: Asset manager
- Learn more: Autoloading
- Learn more: Caching
- Learn more: Cookies
- Learn more: Events
- Learn more: File helper
- Learn more: Html helper
- Learn more: Internationalization
- Learn more: Logging
- Learn more: Number helper
- Learn more: Pagination
- Learn more: Redis client
- Learn more: Rest client
- Learn more: Security helpers
- Learn more: Sessions
- Learn more: String helper
- Learn more: Url helper
- Learn more: Uuid helper
- Learn more: Validation
- Learn more: Views