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

Add message to ConcurrencyException #163

Merged
merged 1 commit into from
Jun 7, 2018

Conversation

enumag
Copy link
Member

@enumag enumag commented Jun 7, 2018

Closes #161.

I don't think we can easily detect if the problem was an aggregate ID or an event ID (not without an additional select to check for duplicates). However the information seems to be in PDO's ErrorInfo so I'd like to simply pass it along in the exception message.

This will of course require another PR for ActionEventEmitterEventStore to pass the message along here instead of the boolean.

I'll send that PR later. Unless of course you're against this solution.


use Prooph\EventStore\Exception\ConcurrencyException;

class ConcurrencyExceptionFactory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a named constructor on the concurrency exception itself, no need for an additional class

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't. ConcurrencyException is in another package which should not be aware of something like PDO.

The only way I could use a named constructor here would be to extend that exception. I slightly prefer this solution though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right. I'm okay with having a factory then.

@prolic
Copy link
Member

prolic commented Jun 7, 2018

About action event emitter, why not set the exception itself instead if bool true?

Same could be for stream not found

@prolic prolic self-assigned this Jun 7, 2018
@enumag
Copy link
Member Author

enumag commented Jun 7, 2018

@prolic Oh I somehow thought the event parameters are limited to just scalars and maybe arrays of scalars. If that's not the case then just setting the exception to the parameter is of course far better since it will preserve the original call stack.

@prolic prolic merged commit fc75107 into prooph:master Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants