37338-vm/lib/WorkflowExceptions.php
2026-03-01 19:13:33 +00:00

51 lines
1.3 KiB
PHP

<?php
class WorkflowException extends Exception {
protected $httpCode;
protected $details;
public function __construct($message = "", $httpCode = 500, $details = [], Throwable $previous = null) {
parent::__construct($message, $httpCode, $previous);
$this->httpCode = $httpCode;
$this->details = $details;
}
public function getHttpCode() {
return $this->httpCode;
}
public function getDetails() {
return $this->details;
}
}
class WorkflowNotFoundException extends WorkflowException {
public function __construct($message = "") {
parent::__construct($message, 404);
}
}
class WorkflowNotAllowedException extends WorkflowException {
public function __construct($message = "") {
parent::__construct($message, 403);
}
}
class WorkflowRuleFailedException extends WorkflowException {
public function __construct($message = "") {
parent::__construct($message, 400);
}
}
class WorkflowEligibilityException extends WorkflowException {
private $reasons;
public function __construct($message = "", $reasons = []) {
parent::__construct($message, 422, ['reasons' => $reasons]);
$this->reasons = $reasons;
}
public function getReasons() {
return $this->reasons;
}
}