Skip to content

Commit ad19b1d

Browse files
committed
Catch all schema exceptions
1 parent 543118c commit ad19b1d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/BaseDocument.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ public function validate(): bool
9393
$this->validator = new Validator($this->schema);
9494
}
9595

96-
if (!$result = $this->validator->check($this->data)) {
97-
$this->error = $this->validator->getLastError();
96+
try {
97+
if (!$result = $this->validator->check($this->data)) {
98+
$this->error = $this->validator->getLastError();
99+
}
100+
} catch (\RuntimeException $e) {
101+
$result = false;
102+
$this->error = $e->getMessage();
98103
}
99104

100105
return $result;

0 commit comments

Comments
 (0)