37338-vm/lib/WorkflowExceptions.php
2026-01-10 19:52:03 +00:00

45 lines
1.4 KiB
PHP

<?php
class WorkflowException extends Exception {
protected $httpCode;
protected $details;
public function __construct($message = "", $code = 0, $httpCode = 500, $details = [], Throwable $previous = null) {
parent::__construct($message, $code, $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 = "Not Found", $details = [], Throwable $previous = null) {
parent::__construct($message, 404, 404, $details, $previous);
}
}
class WorkflowNotAllowedException extends WorkflowException {
public function __construct($message = "Bad Request", $details = [], Throwable $previous = null) {
parent::__construct($message, 400, 400, $details, $previous);
}
}
class WorkflowRuleFailedException extends WorkflowException {
public function __construct($message = "Unprocessable Entity", $details = [], Throwable $previous = null) {
parent::__construct($message, 422, 422, $details, $previous);
}
}
class WorkflowConflictException extends WorkflowException {
public function __construct($message = "Conflict", $details = [], Throwable $previous = null) {
parent::__construct($message, 409, 409, $details, $previous);
}
}