Skip to content

Commit 2762f3c

Browse files
Throw on invalid responses
1 parent 999ee2e commit 2762f3c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Request.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,13 @@ public static function send($action, array $data = null)
317317
return new ServerResponse($fake_response, $bot_name);
318318
}
319319

320-
$response = self::executeCurl($action, $data);
321-
return new ServerResponse(json_decode($response, true), $bot_name);
320+
$response = json_decode(self::executeCurl($action, $data), true);
321+
322+
if (is_null($response)) {
323+
throw new TelegramException('Telegram returned an invalid response! Please your bot name and api token.');
324+
}
325+
326+
return new ServerResponse($response, $bot_name);
322327
}
323328

324329
/**

0 commit comments

Comments
 (0)