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

Handle missing tables #26

Merged
merged 7 commits into from
Dec 25, 2016
Merged

Handle missing tables #26

merged 7 commits into from
Dec 25, 2016

Conversation

prolic
Copy link
Member

@prolic prolic commented Dec 25, 2016

fixes #24

/cc @oqq

if (in_array($statement->errorCode(), $this->persistenceStrategy->uniqueViolationErrorCodes())) {
throw StreamExistsAlready::with($stream->streamName());
}
throw new RuntimeException('Unknown error. Maybe the event streams table is not setup?');
Copy link
Member

Choose a reason for hiding this comment

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

$statement->errorInfo() provides an array with error messages. Maybe you add this strings to get a more meaningful error message?

if (in_array($statement->errorCode(), $this->persistenceStrategy->uniqueViolationErrorCodes())) {
throw StreamExistsAlready::with($stream->streamName());
}
throw new RuntimeException('Unknown error. Maybe the event streams table is not setup?');
Copy link
Member

Choose a reason for hiding this comment

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

$statement->errorInfo() provides an array with error messages. Maybe you add this strings to get a more meaningful error message?

$this->linkTo('foo', $event);
$this->connection = TestUtil::getConnection();
$this->connection->exec(file_get_contents(__DIR__.'/../../scripts/mysql/01_event_streams_table.sql'));
$this->connection->exec(file_get_contents(__DIR__.'/../../scripts/mysql/02_projections_table.sql'));
Copy link
Member

Choose a reason for hiding this comment

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

This lines could be added in TestUtil as "initDefaultDatabaseTables" method, since they are used on other test parts too.

@prolic
Copy link
Member Author

prolic commented Dec 25, 2016

@oqq updated

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 98.246% when pulling e50024d on handle_missing_tables into 55c9403 on master.

@prolic prolic merged commit 81ec9e2 into master Dec 25, 2016
@prolic prolic deleted the handle_missing_tables branch December 25, 2016 11:16
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.

addStreamToStreamsTable throws wrong exception
4 participants