Skip to content

Commit

Permalink
better error messages in projections
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Dec 25, 2016
1 parent 8fedf34 commit e50024d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Projection/PDOEventStoreProjectionTrait.php
Expand Up @@ -45,8 +45,14 @@ protected function acquireLock(): void

if ($statement->rowCount() !== 1) {
if ($statement->errorCode() !== '00000') {
throw new RuntimeException('Unknown error. Maybe the projection table is not setup?');
$errorCode = $statement->errorCode();
$errorInfo = $statement->errorInfo()[2];

throw new RuntimeException(
"Error $errorCode. Maybe the projection table is not setup?\nError-Info: $errorInfo"
);
}

throw new RuntimeException('Another projection process is already running');
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Projection/PDOEventStoreProjectionTestCase.php
Expand Up @@ -229,7 +229,7 @@ function (array $state, Message $event): array {
public function it_handles_missing_projection_table(): void
{
$this->expectException(\Prooph\EventStore\PDO\Exception\RuntimeException::class);
$this->expectExceptionMessage('Unknown error. Maybe the projection table is not setup?');
$this->expectExceptionMessage('Maybe the projection table is not setup?');

$this->prepareEventStream('user-123');

Expand Down

0 comments on commit e50024d

Please sign in to comment.