dblayeroo: allow the DBException function to be extended easily to log in the application

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3936 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-09-05 14:36:47 +00:00
parent 52d2dfb52f
commit 9fa5cc4ed2

View File

@@ -2907,6 +2907,17 @@ class dblayeroo
*/
public function DBException ($message)
/* {{{ */
{
$message = $this->DBExceptionMsg ($message);
throw new \Exception ($message, 500);
}
/* }}} */
/** Return the $message adapted with the debug trace if needed
* @param string $message The message to throw in the exception
*/
public function DBExceptionMsg ($message)
/* {{{ */
{
$backtrace = debug_backtrace ();
if ($this->debug)
@@ -2924,10 +2935,10 @@ class dblayeroo
$method = $backtrace["function"];
$message .= " ($filename:$line [$method])";
}
throw new \Exception ($message, 500);
return $message;
}
/* }}} */
/* }}} */
/** Debug function
* @param mixed ...$message The message to display in debug
*/