-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw current exception instead of recreate them #98
base: 3.x
Are you sure you want to change the base?
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. |
@@ -33,8 +33,7 @@ public function write(Mapper $mapper, string $method, Record $record) : void | |||
$this->commit(); | |||
} catch (Exception $e) { | |||
$this->rollBack(); | |||
$c = get_class($e); | |||
throw new $c($e->getMessage(), $e->getCode(), $e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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