Commit e541cf9e authored by arisk's avatar arisk

Added PDO error code

parent 38562d50
...@@ -22,6 +22,7 @@ class Exception extends \Exception { ...@@ -22,6 +22,7 @@ class Exception extends \Exception {
$this->inner = $inner; $this->inner = $inner;
$this->setMessage($sql, $bindings); $this->setMessage($sql, $bindings);
$this->setCode();
} }
/** /**
...@@ -37,5 +38,15 @@ class Exception extends \Exception { ...@@ -37,5 +38,15 @@ class Exception extends \Exception {
$this->message .= "\n\nSQL: ".$sql."\n\nBindings: ".var_export($bindings, true); $this->message .= "\n\nSQL: ".$sql."\n\nBindings: ".var_export($bindings, true);
} }
/**
* Set the exception code.
*
* @return void
*/
protected function setCode()
{
$this->code = $this->inner->getCode();
}
} }
\ No newline at end of file
Markdown is supported
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