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/config.default.php b/src/config.default.php
index d59c087..b36b622 100644
--- a/src/config.default.php
+++ b/src/config.default.php
@@ -36,7 +36,7 @@
 $conf["logo"] = ""; // Optional, set it to a URL of a logo which will be displayed in the nav bar.
 $conf["enableRecovery"] = false; // Sets whether users can recover passwords.
 $conf["debug"] = false; // Sets whether the app shows debug information useful to the developer. WARNING: DO NOT ENABLE IN PRODUCTION AS IT MAY SHOW SENSITIVE INFORMATION
-$conf["superdebug"] = false; // Sets whether to enable super debug mode (for now it only disables redirects and displays verbose errors when calling security::checkParams())
+$conf["superdebug"] = false; // Sets whether to enable super debug mode (for now it only disables redirects, displays verbose errors when calling security::checkParams() and throws an ErrorException whenever the severity is included in |error_reporting()|)
 
 $conf["pdfs"] = [];
 $conf["pdfs"]["workersAlwaysHaveBreakfastAndLunch"] = false; // Sets up whether when an incident overlaps breakfast or lunch, the length of the incident should subtract lunch and breakfast time (false) or not because workers will have lunch or breakfast at another time inside of the work schedule (true). WARNING: SETTING THIS TO TRUE MAY LEAD TO UNEXPECTED RESULTS IN THE SUMMARY SHOWN AT THE BOTTOM OF DETAILED PDFs.
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');