Added PDO error code

This commit is contained in:
arisk 2012-09-14 11:16:46 +07:00
parent 38562d5007
commit e541cf9ebd
1 changed files with 11 additions and 0 deletions

View File

@ -22,6 +22,7 @@ public function __construct($sql, $bindings, \Exception $inner)
$this->inner = $inner;
$this->setMessage($sql, $bindings);
$this->setCode();
}
/**
@ -37,5 +38,15 @@ protected function setMessage($sql, $bindings)
$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();
}
}