Hi
I work with Moodle 3.7.1 and I want to customize the error page (see above) or other option is redirect to other error page. How can I do this?
Thanks
There is no way to fully customise this without changing core Moode code. (Because this happens so early in the process of Moodle starting up, none of the standard Moodle customisation options will work yet.)
You only need to add a little bit in lib/dmllib.php. Then you can put the code to do whatever error handling you want in local/error/lib.php (or whatever other file you want to use.)
try { $DB->connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, $CFG->dboptions); } catch (moodle_exception $e) { // ou-specific begins #813 require_once(__DIR__ . '/../local/error/lib.php'); ou_http_error('Database connection failed.'); // ou-specific ends #813
Acutally, there is one way Moodle core could support this: We coudl allow people to define things like this in config.php:
$CFG->dbconnecterrorhander = 'ou_http_error';
$CFG->dbconnecterrorhanderfile = 'local/error/lib.php';
Do other peple customise that error page like this? Should we open a MDL for adding those hooks?