Editor
2 months ago
Embed
1 month ago
Links
2 months ago
Listing
9 months ago
Options
2 years ago
Preview
1 month ago
Renderer
4 days ago
RestApi
1 week ago
Scheduler
4 days ago
Segment
1 year ago
Sending
1 week ago
Sharing
1 month ago
Shortcodes
3 days ago
Statistics
1 week ago
ViewInBrowser
1 month ago
ApiDataSanitizer.php
3 years ago
AutomatedLatestContent.php
2 months ago
AutomaticEmailsRepository.php
3 years ago
BlockPostQuery.php
2 months ago
BulkActionController.php
1 month ago
BulkActionException.php
1 month ago
DynamicProducts.php
11 months ago
NewsletterCoupon.php
2 months ago
NewsletterDeleteController.php
2 years ago
NewsletterHtmlSanitizer.php
2 years ago
NewsletterPostsRepository.php
2 years ago
NewsletterResendController.php
4 days ago
NewsletterSaveController.php
1 month ago
NewsletterValidator.php
1 year ago
NewslettersRepository.php
2 weeks ago
StatusController.php
1 month ago
Url.php
2 months ago
index.php
3 years ago
BulkActionException.php
43 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Newsletter; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use RuntimeException; |
| 9 | use Throwable; |
| 10 | |
| 11 | /** |
| 12 | * Domain-level error raised by {@see BulkActionController}. The HTTP |
| 13 | * transport layer (REST endpoint or legacy JSON endpoint) is responsible |
| 14 | * for translating the carried status code + error code into its own |
| 15 | * response envelope. |
| 16 | */ |
| 17 | class BulkActionException extends RuntimeException { |
| 18 | /** @var string */ |
| 19 | private $errorCode; |
| 20 | |
| 21 | /** @var int */ |
| 22 | private $statusCode; |
| 23 | |
| 24 | public function __construct( |
| 25 | string $message, |
| 26 | string $errorCode, |
| 27 | int $statusCode = 400, |
| 28 | ?Throwable $previous = null |
| 29 | ) { |
| 30 | parent::__construct($message, 0, $previous); |
| 31 | $this->errorCode = $errorCode; |
| 32 | $this->statusCode = $statusCode; |
| 33 | } |
| 34 | |
| 35 | public function getErrorCode(): string { |
| 36 | return $this->errorCode; |
| 37 | } |
| 38 | |
| 39 | public function getStatusCode(): int { |
| 40 | return $this->statusCode; |
| 41 | } |
| 42 | } |
| 43 |