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
1 changed files with 3 additions and 11 deletions

View File

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