Skip to content
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

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

ElGigi
Copy link

@ElGigi ElGigi commented Nov 2, 2018

Hello,

In case of some exceptions, order of parameters is not the same as Exception.

Error: Wrong parameters for PDOException([string $message [, long $code [, Throwable $previous = NULL]]])

So throw the current exception instead of recreate them is preferable.

Ronan

@ElGigi
Copy link
Author

ElGigi commented Dec 11, 2018

Any news ?

@froschdesign
Copy link
Contributor

@ElGigi
Have you check the unit tests, because the associated test failed with your changes:

$previous = $e->getPrevious();
$this->assertSame(
$previous->getMessage(),
"Primary key value for 'id' changed"
);

@pmjones
Is there a reason why Travis was removed in db21a14?

@ElGigi
Copy link
Author

ElGigi commented Jan 2, 2019

@froschdesign Thanks, test fixed ;)

@ElGigi
Copy link
Author

ElGigi commented Feb 13, 2019

Any news?

I always have the error:
Error: Wrong parameters for PDOException([string $message [, long $code [, Throwable $previous = NULL]]]) in ...\vendor\atlas\orm\src\Transaction\AutoTransact.php:37

Thanks.

@ElGigi
Copy link
Author

ElGigi commented Apr 30, 2019

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);
Copy link
Contributor

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 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants