Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function create(TelegramResponse $response): self
- {
- $data = $response->getDecodedBody();
- $code = null;
- $message = null;
- if (isset($data['ok'], $data['error_code']) && $data['ok'] === false) {
- $code = $data['error_code'];
- $message = $data['description'] ?? 'Unknown error from API.';
- }
- // Others
- return new static($response, new TelegramOtherException($message, $code));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement