Files
piratepoet/mailpoet/lib/Automation/Exceptions.php
2022-02-21 09:56:26 +01:00

23 lines
663 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation;
use MailPoet\Automation\Exceptions\InvalidStateException;
use MailPoet\Automation\Exceptions\UnexpectedValueException;
class Exceptions {
private const API_NO_JSON_BODY = 'mailpoet_automation_api_no_json_body';
public function __construct() {
throw new InvalidStateException(
"This is a static factory class. Use it via 'Exception::someError()' factories."
);
}
public static function apiNoJsonBody(): UnexpectedValueException {
return UnexpectedValueException::create()
->withErrorCode(self::API_NO_JSON_BODY)
->withMessage('No JSON body passed.');
}
}