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:
@@ -2907,6 +2907,17 @@ class dblayeroo
|
|||||||
*/
|
*/
|
||||||
public function DBException ($message)
|
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 ();
|
$backtrace = debug_backtrace ();
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
@@ -2924,10 +2935,10 @@ class dblayeroo
|
|||||||
$method = $backtrace["function"];
|
$method = $backtrace["function"];
|
||||||
$message .= " ($filename:$line [$method])";
|
$message .= " ($filename:$line [$method])";
|
||||||
}
|
}
|
||||||
throw new \Exception ($message, 500);
|
return $message;
|
||||||
}
|
}
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
|
/* }}} */
|
||||||
/** Debug function
|
/** Debug function
|
||||||
* @param mixed ...$message The message to display in debug
|
* @param mixed ...$message The message to display in debug
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user