| 1 | <?php |
||
| 5 | class CouldNotSendNotification extends \Exception |
||
| 6 | { |
||
| 7 | 4 | public static function serviceBadRequest($response) |
|
| 8 | { |
||
| 9 | 4 | $response = json_decode($response, true); |
|
| 10 | |||
| 11 | 4 | $message = isset($response['message']) ? $response['message'] : ''; |
|
| 12 | 4 | $errors = isset($response['errors']) ? implode(',', $response['errors']) : ''; |
|
| 13 | |||
| 14 | 4 | return new static("PagerDuty returned 400 Bad Request: $message - $errors"); |
|
| 15 | } |
||
| 16 | |||
| 17 | 2 | public static function rateLimit() |
|
| 18 | { |
||
| 19 | // https://v2.developer.pagerduty.com/docs/errors |
||
| 20 | 2 | return new static('PagerDuty returned 429 Too Many Requests'); |
|
| 21 | } |
||
| 22 | |||
| 23 | public static function unknownError($code) |
||
| 27 | } |
||
| 28 |