/Assets/Images/Saturn-logo.webp" class="w-1/4 mx-auto" alt="Logo">
-
+
+
+
+
+
= Out($ErrorDescription); ?>
diff --git a/Processes/Saturn/AccountManager/Join.php b/Processes/Saturn/AccountManager/Join.php
index e8cdbf8..e8831ab 100644
--- a/Processes/Saturn/AccountManager/Join.php
+++ b/Processes/Saturn/AccountManager/Join.php
@@ -26,18 +26,29 @@
$Password = password_hash($_POST['password'], SECURITY_PASSWORD_ALGORITHM);
$UniqID = $UUID->Generate();
- $Result = $DB->Insert('user', '`id`, `uuid`, `username`, `email`, `password`', "NULL, '".$UniqID."', '".$Username."', '".$Email."', '".$Password."'");
- $Result = $DB->Insert('user_permissions', '`id`, `uuid`', "NULL, '".$UniqID."'");
- if ($DB->Error() == null) {
- header('Location: /account?success=created');
- } else {
+ try {
+ $Result = $DB->Insert('user', '`id`, `uuid`, `username`, `email`, `password`', "NULL, '" . $UniqID . "', '" . $Username . "', '" . $Email . "', '" . $Password . "'");
+ $Result = $DB->Insert('user_permissions', '`id`, `uuid`', "NULL, '" . $UniqID . "'");
+ if ($DB->Error() == null) {
+ header('Location: /account?success=created');
+ } else {
+ $EH = new ErrorHandler();
+ $EH->SaturnError(
+ '500',
+ $DB->Error(),
+ 'Database error',
+ 'There was a problem with the database query.',
+ SATSYS_DOCS_URL . '/troubleshooting/errors/database#' . strtolower($DB->Error())
+ );
+ }
+ } catch (Exception $e) {
$EH = new ErrorHandler();
$EH->SaturnError(
'500',
- $DB->Error(),
+ 'DBMS-4',
'Database error',
- 'There was a problem with the database query.',
- SATSYS_DOCS_URL.'/troubleshooting/errors/database#'.strtolower($DB->Error())
+ 'There was a problem with the database query. '.$e->getMessage(),
+ SATSYS_DOCS_URL . '/troubleshooting/errors/database#' . strtolower($DB->Error())
);
}
} else {
diff --git a/Processes/Saturn/DatabaseManager/DBMS.php b/Processes/Saturn/DatabaseManager/DBMS.php
index e409c41..c88b743 100644
--- a/Processes/Saturn/DatabaseManager/DBMS.php
+++ b/Processes/Saturn/DatabaseManager/DBMS.php
@@ -60,7 +60,18 @@ public function Select(string $What, string $From, string|null $Where, string $A
public function Query(string $Query)
{
- return $this->Database->Query($Query);
+ try {
+ return $this->Database->Query($Query);
+ } catch (\Exception $e) {
+ $err = new ErrorHandler();
+ $err->SaturnError(
+ '500',
+ 'DBMS-4',
+ 'An unexpected error occurred whilst executing the database query.',
+ $e->getMessage(),
+ SATSYS_DOCS_URL.'/troubleshooting/errors/database'
+ );
+ }
}
public function Insert(string $Into, string|null $Columns, string|null $Values): array|object|int|null
diff --git a/Processes/Start.php b/Processes/Start.php
index 35ea9ca..6247d1c 100644
--- a/Processes/Start.php
+++ b/Processes/Start.php
@@ -16,14 +16,14 @@
$Session = new Session();
$Session->Start();
-register_shutdown_function('SaturnEnd');
-
function SaturnEnd(): void
{
$Actions = new Actions();
$Actions->Run('Saturn.End');
}
+register_shutdown_function('SaturnEnd');
+
// ACTIONS
$ActionList = [];
$Actions = new Actions();
diff --git a/index.php b/index.php
index a1581cb..987712b 100644
--- a/index.php
+++ b/index.php
@@ -11,6 +11,6 @@
//
// SATURN CMS VERSION 1.0.0
// PIXELSET -- APACHE LICENSE 2.0
-
+error_reporting(E_ALL);
require_once __DIR__.'/Processes/Load.php';
require_once __DIR__.'/Processes/Start.php';