Skip to content

Commit

Permalink
handled Yiisoft\\Db\\Exception\\Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadasjad committed Sep 19, 2024
1 parent 01ced8a commit 1f5d7c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Validator/TableExistsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public function validate(mixed $value, object $rule, ValidationContext $context)

$result = new Result();

$tableSchema = $this->connection->getTableSchema($value);
try{
$tableSchema = $this->connection->getTableSchema($value);
} catch (\Yiisoft\Db\Exception\Exception $e) {
$tableSchema = null;

Check warning on line 34 in src/Validator/TableExistsHandler.php

View check run for this annotation

Codecov / codecov/patch

src/Validator/TableExistsHandler.php#L33-L34

Added lines #L33 - L34 were not covered by tests
}

if ($tableSchema === null) {
$result->addError(sprintf('Table "%s" does not exist.', $value));
Expand Down

0 comments on commit 1f5d7c5

Please sign in to comment.