Skip to content

Commit bc076e0

Browse files
committed
Merge remote-tracking branch 'antonio/catchresponseexceptions' into develop
2 parents ea8cf24 + 2762f3c commit bc076e0

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
@@ -316,8 +316,13 @@ public static function send($action, array $data = null)
316316
return new ServerResponse($fake_response, $bot_name);
317317
}
318318

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

323328
/**

0 commit comments

Comments
 (0)