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 {
public function formatMessage() {
$store = \qfq\store\Store::getInstance('');
$message = '<div style="border: 1px red solid">' .
$this->getMessage() .
'<p>' . $store->getVar(SYSTEM_SQL_FINAL, STORE_SYSTEM) . '</p>' .
'<p>' . str_replace("\n", "<br>", print_r($store->getVar(SYSTEM_SQL_PARAM_ARRAY, STORE_SYSTEM), true)) . '</p>' .
'</div>';
$message = '<table border=1><tr><th>DB 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>' .
'<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);
}
......
......@@ -9,6 +9,9 @@
namespace qfq\exceptions;
require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/Constants.php');
/**
* Class UserException
*
......@@ -23,10 +26,15 @@ class UserException extends \Exception {
* @return string HTML formatted error string
*/
public function formatMessage() {
$message = '<div style="border: 1px black solid">';
$message .= $this->getMessage();
$message .= '</div>';
$store = \qfq\store\Store::getInstance('');
$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