diff --git a/dblayeroo.php b/dblayeroo.php index 66f2341..b813239 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -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 */