Add storage service for workflows & create workflow method

[MAILPOET-4136]
This commit is contained in:
Jan Jakes
2022-03-07 11:34:04 +01:00
committed by Veljko V
parent 97ad4cffb5
commit 41cb2c4034
3 changed files with 37 additions and 0 deletions

View File

@ -7,6 +7,7 @@ use MailPoet\Automation\Engine\Exceptions\UnexpectedValueException;
class Exceptions {
private const MIGRATION_FAILED = 'mailpoet_automation_migration_failed';
private const DATABASE_ERROR = 'mailpoet_automation_database_error';
private const API_METHOD_NOT_ALLOWED = 'mailpoet_automation_api_method_not_allowed';
private const API_NO_JSON_BODY = 'mailpoet_automation_api_no_json_body';
@ -22,6 +23,12 @@ class Exceptions {
->withMessage(__(sprintf('Migration failed: %s', $error), 'mailpoet'));
}
public static function databaseError(string $error): InvalidStateException {
return InvalidStateException::create()
->withErrorCode(self::DATABASE_ERROR)
->withMessage(__(sprintf('Database error: %s', $error), 'mailpoet'));
}
public static function apiMethodNotAllowed(): UnexpectedValueException {
return UnexpectedValueException::create()
->withStatusCode(405)