Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| WorkflowValidationException | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Engine\Domain\Exception; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Workflow Validation Domain Exception. |
| 13 | * |
| 14 | * Thrown when a synchronous before-save workflow rule halts execution |
| 15 | * or aborts saving with a custom user-defined validation message. |
| 16 | * |
| 17 | * @package App\Core\Engine\Domain\Exception |
| 18 | */ |
| 19 | final class WorkflowValidationException extends \RuntimeException |
| 20 | { |
| 21 | /** |
| 22 | * WorkflowValidationException constructor. |
| 23 | * |
| 24 | * @param string $workflowName Name of the triggering workflow. |
| 25 | * @param string $userMessage User-defined error message explaining the failure. |
| 26 | */ |
| 27 | public function __construct( |
| 28 | public readonly string $workflowName, |
| 29 | public readonly string $userMessage |
| 30 | ) { |
| 31 | parent::__construct(sprintf('[Workflow: %s] %s', $workflowName, $userMessage)); |
| 32 | } |
| 33 | } |