Setting the exception code in the constructor
This commit is contained in:
parent
e541cf9ebd
commit
752161cae3
|
@ -22,7 +22,9 @@ public function __construct($sql, $bindings, \Exception $inner)
|
|||
$this->inner = $inner;
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the exception code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCode()
|
||||
{
|
||||
$this->code = $this->inner->getCode();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue