feat: throw an error for all severities when superdebug is enabled
This will help troubleshoot issues, since unhandled ErrorExceptions show
the full stacktrace.
As an example, with this change, a warning will throw an ErrorException
instead of logging a warning.
GitOrigin-RevId: c2d18aef33d95123308516bebda7fa76cfcaeb47
diff --git a/src/core.php b/src/core.php
index 086bf58..f87a9c2 100644
--- a/src/core.php
+++ b/src/core.php
@@ -35,6 +35,15 @@
// Getting configuration
require_once(__DIR__."/config.php");
+// Error handler
+if ($conf['superdebug']) {
+ set_error_handler(function($severity, $message, $file, $line) {
+ if (error_reporting() & $severity) {
+ throw new ErrorException($message, 0, $severity, $file, $line);
+ }
+ });
+}
+
// Setting timezone and locale accordingly
date_default_timezone_set("Europe/Madrid");
setlocale(LC_TIME, 'es_ES.UTF-8', 'es_ES', 'es');