Throw current exception instead of recreate them#98
Throw current exception instead of recreate them#98ElGigi wants to merge 2 commits intoatlasphp:3.xfrom
Conversation
|
Any news ? |
|
@ElGigi Atlas.Orm/tests/Transaction/AutoTransactTest.php Lines 30 to 34 in d3d6bdb @pmjones |
|
@froschdesign Thanks, test fixed ;) |
|
Any news? I always have the error: Thanks. |
|
Any news? Thanks. |
| } catch (Exception $e) { | ||
| $this->rollBack(); | ||
| $c = get_class($e); | ||
| throw new $c($e->getMessage(), $e->getCode(), $e); |
There was a problem hiding this comment.
I think probably casting to int will help here.
public __construct ([ string $message = "" [, int $code = 0 [, Throwable $previous = NULL ]]] )
taken from https://www.php.net/manual/en/exception.construct.php .
So the order of exception seems not changing. Also if this code is removed, that may affect other parts for this can become a BC break for people who rely on multiple exception. ( Just a thought )
Hello,
In case of some exceptions, order of parameters is not the same as Exception.
So throw the current exception instead of recreate them is preferable.
Ronan