Setting the exception code in the constructor

This commit is contained in:
arisk
2012-09-14 16:47:55 +07:00
parent e541cf9ebd
commit 752161cae3

View File

@@ -22,7 +22,9 @@ class Exception extends \Exception {
$this->inner = $inner;
$this->setMessage($sql, $bindings);
$this->setCode();
// Set the exception code
$this->code = $inner->getCode();
}
/**
@@ -39,14 +41,4 @@ class Exception extends \Exception {
$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();
}
}