We use the trigger_error for everything from Posting Success Messages to Errors with adding custom BBcodes.
We also have general errors and debug errors. General Errors are used for DB, template, cache and module problems. Debug errors are used for undefined variables and more.
General Errors are recorded in the Error Log.
Ascreaus Situation:
We now use modal windows for some actions (like marking topics read) but otherwise it is the same as in olympus.
Problems:
1) trigger_error() is over used and abused
2) Flash messages are nicer for a user than whole pages and modal boxes.
3) Logging is not optional, and there isn't an option to log debug errors.
4) There are no notification settings
Suggested Solution - Backend functions to produce errors/confirmation boxes/success messages:
A new error class with the following public functions:
- flash($message, $dismiss_method, $type, $redirect = null)
This will produce a little flash message. It will display the message. The dismiss method details whether it will fade after a certain amount of time, or whether it will stay there until dismissed. The type is failed/success and will then show a tick or cross. The redirect will be the page it should be shown on. If no option is given then it will show it on the current page. The flash message will be something like http://www.erichynds.com/examples/jquery-notify/ - confirm($message, $modal, $yes, $no)
This will either produce a flash message or a modal box (decided with true or false for $modal) with a yes/no confirmation option. $yes and $no will decide where to send them should they select those options. - debug($message)
This will produce the debug error as we have them now, except there will be functionality to notify people about them or log them. - general($message)
This will produce a general error as we have them now, except there will be functionality to notify people about them or log them. - info_page($message)
Will produce an information page, the current usage in Olympus when using trigger_error(). - modal($message)
This will produce a modal box, as the current ascreaus behaviour is for marking forums read.
There will then be the admin options for the following:
Checkbox for what would you like to log (by default GE is selected):
General Errors and Debug Errors
Checkbox for what would you like to notify you about (by default neither selected):
General Errors and Debug Errors
Method of Notifying (Checkbox):
PM, Email or Jabber.
Then for whichever is selected it will ask for the User ID's of Users to PM or emails to email or Jabber Addresses to Jabber.
As such this means:
- Easier to produce errors
- No information pages unless really needed.
- Everything is easily accessible.
- No more abusing trigger_error() - This will continue to be supported for BC like request_var(). It will just run info_page().
- Logging is now completely optional and more flexible
- You can log debug errors
- You can choose to be notified of events.