Commit a64d950e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Exceptions.php: Output now formatted with a table. Formelement name/id displayed.

parent 2b8cd878
...@@ -27,11 +27,15 @@ class DbException extends \Exception { ...@@ -27,11 +27,15 @@ class DbException extends \Exception {
public function formatMessage() { public function formatMessage() {
$store = \qfq\store\Store::getInstance(''); $store = \qfq\store\Store::getInstance('');
$message = '<div style="border: 1px red solid">' . $message = '<table border=1><tr><th>DB Exception</th></tr>' .
$this->getMessage() . '<tr><td>Message</td><td><b>' . $this->getMessage() . '</b></td></tr>' .
'<p>' . $store->getVar(SYSTEM_SQL_FINAL, STORE_SYSTEM) . '</p>' . '<tr><td>Form</td><td>' . $store->getVar(SYSTEM_FORM, STORE_SYSTEM) . '</td></tr>' .
'<p>' . str_replace("\n", "<br>", print_r($store->getVar(SYSTEM_SQL_PARAM_ARRAY, STORE_SYSTEM), true)) . '</p>' . '<tr><td>Form Element</td><td>' . $store->getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM) . '</td></tr>' .
'</div>'; '<tr><td>Form Element Column</td><td>' . $store->getVar(SYSTEM_FORM_ELEMENT_COLUMN, STORE_SYSTEM) . '</td></tr>' .
'<tr><td>SQL before evaluation</td><td>' . $store->getVar(SYSTEM_SQL_RAW, STORE_SYSTEM) . '</td></tr>' .
'<tr><td>SQL after evaluation</td><td>' . $store->getVar(SYSTEM_SQL_FINAL, STORE_SYSTEM) . '</td></tr>' .
'<tr><td>SQL Params</td><td>' . str_replace("\n", "<br>", print_r($store->getVar(SYSTEM_SQL_PARAM_ARRAY, STORE_SYSTEM), true)) . '</td></tr>' .
'</table>';
return ($message); return ($message);
} }
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
namespace qfq\exceptions; namespace qfq\exceptions;
require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/Constants.php');
/** /**
* Class UserException * Class UserException
* *
...@@ -23,10 +26,15 @@ class UserException extends \Exception { ...@@ -23,10 +26,15 @@ class UserException extends \Exception {
* @return string HTML formatted error string * @return string HTML formatted error string
*/ */
public function formatMessage() { public function formatMessage() {
$message = '<div style="border: 1px black solid">'; $store = \qfq\store\Store::getInstance('');
$message .= $this->getMessage();
$message .= '</div>'; $message = '<table border=1><tr><th>User Exception</th></tr>' .
'<tr><td>Message</td><td><b>' . $this->getMessage() . '</b></td></tr>' .
'<tr><td>Form</td><td>' . $store->getVar(SYSTEM_FORM, STORE_SYSTEM) . '</td></tr>' .
'<tr><td>Form Element</td><td>' . $store->getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM) . '</td></tr>' .
'<tr><td>Form Element Column</td><td>' . $store->getVar(SYSTEM_FORM_ELEMENT_COLUMN, STORE_SYSTEM) . '</td></tr>' .
'</table>';
return($message); return ($message);
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment