In other projects (not Elgg) we sometime use the following error handler.
Could yo please advise how to do it in Elgg?
My Elgg version 2.3.13
Thank you very much
<?php
define('LIVE', FALSE);// website in development mode
//define('LIVE', TRUE);// website in live mode
// the error handler:
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {
$message = "An error occurred in script '$e_file' on line $e_line: $e_message\n";
$message .= print_r ($e_vars, 1);
if (!LIVE) { // Development (print the error).
echo '<pre>' . $message . "\n";
echo '</pre><br />';
} else { // LIVE - Don't show the error.
echo '<div style=" etc. ">A system error occurred. We apologize for the inconvenience.<br />Please try to refresh the page.<br />If the error persists, please contact the webmaster.</div>';
exit();
}
}
set_error_handler ('my_error_handler');
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Reuven@reuven
Reuven - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Reuven@reuven
Reuven - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- Reuven@reuven
Reuven - 0 likes
You must log in to post replies.Just override view of this file:
Thank you RvR.
Does the 404 view respond to all types of php errors or only to wrong addresses?
For HTTP 404 responses only.
For another responses use another views in this folder:
\vendor\elgg\elgg\views\default\errors\
Thank you
@rvrv not entirely correct views\default\errors only get used for http exceptions
all other exceptions \ errors get handled by views\failsafe\excpetions\. admin_exceptions.php for site admins and exceptions.php for users.
If you enable the developers plugin (bundled with Elgg) the admin_exceptions get overruled with more information to help you debug, so no need for custom code (but you could)
Thank you @Jerome
However, I do not know how to use it. Could you please give me some guidance.
Thank you very much.