Skip to content

Commit

Permalink
make use of projection not found exception
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Jun 24, 2017
1 parent e714393 commit 68174e1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -18,7 +18,7 @@
"prefer-stable": true,
"require": {
"php": "^7.1",
"prooph/event-store": "^7.1.2"
"prooph/event-store": "^7.1.3"
},
"require-dev": {
"sandrokeil/interop-config": "^2.0.1",
Expand Down
12 changes: 12 additions & 0 deletions src/Projection/MariaDbProjectionManager.php
Expand Up @@ -134,6 +134,10 @@ public function deleteProjection(string $name, bool $deleteEmittedEvents): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function resetProjection(string $name): void
Expand All @@ -155,6 +159,10 @@ public function resetProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function stopProjection(string $name): void
Expand All @@ -176,6 +184,10 @@ public function stopProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function fetchProjectionNames(?string $filter, int $limit = 20, int $offset = 0): array
Expand Down
12 changes: 12 additions & 0 deletions src/Projection/MySqlProjectionManager.php
Expand Up @@ -134,6 +134,10 @@ public function deleteProjection(string $name, bool $deleteEmittedEvents): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function resetProjection(string $name): void
Expand All @@ -155,6 +159,10 @@ public function resetProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function stopProjection(string $name): void
Expand All @@ -176,6 +184,10 @@ public function stopProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function fetchProjectionNames(?string $filter, int $limit = 20, int $offset = 0): array
Expand Down
12 changes: 12 additions & 0 deletions src/Projection/PostgresProjectionManager.php
Expand Up @@ -134,6 +134,10 @@ public function deleteProjection(string $name, bool $deleteEmittedEvents): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function resetProjection(string $name): void
Expand All @@ -155,6 +159,10 @@ public function resetProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function stopProjection(string $name): void
Expand All @@ -176,6 +184,10 @@ public function stopProjection(string $name): void
if ($statement->errorCode() !== '00000') {
throw Exception\RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}

if (0 === $statement->rowCount()) {
throw ProjectionNotFound::withName($name);
}
}

public function fetchProjectionNames(?string $filter, int $limit = 20, int $offset = 0): array
Expand Down

0 comments on commit 68174e1

Please sign in to comment.