PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Common/Exceptions/ValidationException.php +20 -5 1.1.1 → 1.5 View file →
@@ -9,14 +9,15 @@
9 9
10 10 use Exception;
11 11
12 12 /**
13 - * Class ValidationException
14 - *
15 - * @package IvyForms\Common\Exceptions
13 + * ValidationException class
16 14 */
17 15 class ValidationException extends Exception
18 16 {
17 + /** @var array<string, string|array{code: string}> */
18 + private array $fieldErrors;
19 +
19 20 /**
20 21 * ValidationException constructor.
21 22 *
22 23 * @param string $message
@@ -21,10 +22,24 @@
21 22 *
22 23 * @param string $message
23 24 * @param int $code
24 25 * @param Exception|null $previous
26 + * @param array<string, string|array{code: string}> $fieldErrors
25 27 */
26 - public function __construct($message = 'validation_failed', $code = 0, Exception $previous = null)
28 + public function __construct(
29 + $message = 'validation_failed',
30 + $code = 0,
31 + ?Exception $previous = null,
32 + array $fieldErrors = []
33 + ) {
34 + parent::__construct($message, $code, $previous);
35 + $this->fieldErrors = $fieldErrors;
36 + }
37 +
38 + /**
39 + * @return array<string, string|array{code: string}>
40 + */
41 + public function getFieldErrors(): array
27 42 {
28 - parent::__construct($message, $code, $previous);
43 + return $this->fieldErrors;
29 44 }
30 45 }