-
-
Notifications
You must be signed in to change notification settings - Fork 49
About Errors
Chyrp Lite offers developers a few ways to handle and report errors. The level of error reporting and the verbosity of output depends on whether debug mode is enabled.
The error()
function is the backbone of error handling in Chyrp Lite. It will be called automatically if an error or exception is encountered, but it can also be called directly and supplied a HTTP error status code, which will be sent to the user-agent. Be aware that this function will report the error to the visitor on a pretty error page and then end execution immediately, so it’s best avoided for recoverable errors.
For recoverable errors you can use the Flash class to display a warning to the user. Chyrp Lite generally tries to use flashes to report errors encountered on the visitor-facing blog pages. You’ll see Flash being used a lot in MainController, for example.
This helper function is a shortcut to return error 403: Forbidden. If the visitor is accessing a blog page, this function will attempt to display the error message in a template provided by the current theme.
This helper function is a shortcut to return error 404: Not Found. If the visitor is accessing a blog page, this function will attempt to display the error message in a template provided by the current theme.
A backtrace will be captured and enumerated on the pretty error page displayed by error()
.
Failure states will be logged to the file error_log.txt in the install directory.
In production mode, errors of level E_NOTICE
and E_USER_NOTICE
will be ignored, meaning that you can use the following code to trigger errors that are reported only in debug mode:
trigger_error("Foobar!", E_USER_NOTICE);
This is the wiki for Chyrp Lite: An ultra-lightweight blogging engine, written in PHP.
- About Permissions
- Tour of a Theme
- Twig Reference
- Twig Variables
- Object Attributes
- Routes and Controllers
- Making Your First Module
- Debug and Tester Modes
- About Errors
- Introduction to Helpers
- Introduction to Translations
- Introduction to Triggers
- Anatomy of info.php Files
- Anatomy of a Feather
- Anatomy of a Module
- Anatomy of a Theme
- Anatomy of a Post
- Localizing Extensions
- Adding Ajax Functionality
- Working with JavaScript
- Working with Model
- Working with Config