-
Notifications
You must be signed in to change notification settings - Fork 0
Error and Notification Manager
As for many other things, error management in MFX is mostly automated.
Errors triggered during the execution of your scripts will be catched by MFX's Error Manager and included in a specific part of the page template.
You can also call PHP's native trigger_error
function to raise a custom error on your side.
The Error Manager will comply with the current error reporting level, as any error handler would do.
In complement of errors, MFX also handles notifications. Different to errors, notifications are only string messages and do not carry any other context information. But they are obviously useful to provide information to the user when some operations are carried.
Just like errors, notifications are handled automatically by the Error Manager and output in a specific part of the page template.
You can trigger a notification using the following method:
trigger_notif(string $message)
It is common for errors and notifications to be raised during a request, with the web server redirecting to a new page to display relevant information.
In order to avoid losing track of any error or notification, the status of the Error Manager is "freezed" (or serialized) into the current session before the redirection and "unfreezed" (or deserialized) on the next request.
Errors and notifications are cleared out as soon as the content of the Error Manager is flushed out to the web page.
In a normal workflow, MFX takes care of flushing out errors and notifications for all VIEW
, JSON
and XML
requests (see Request Results). This is also true for STATUS
requests that output JSON or XML content.
However, for other content types, errors won't be flushed and will be reported on the next flush-compatible content produced by the server.
Getting Started | Framework Reference | API Reference | MFX is released under the MIT license