@codebam/cf-workers-telegram-bot 11.6.0 → 11.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,16 @@ export default class TelegramApi {
27
27
  async fetchAndLog(url, slug, data) {
28
28
  const response = await fetch(url);
29
29
  if (response.status !== 200) {
30
- throw new Error(`Telegram API error: ${String(response.status)} ${response.statusText}`);
30
+ const cloned = response.clone();
31
+ let errorDescription = '';
32
+ try {
33
+ const json = (await cloned.json());
34
+ errorDescription = json.description ? `: ${json.description}` : '';
35
+ }
36
+ catch {
37
+ // ignore
38
+ }
39
+ throw new Error(`Telegram API error: ${String(response.status)} ${response.statusText}${errorDescription}`);
31
40
  }
32
41
  const cloned = response.clone();
33
42
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebam/cf-workers-telegram-bot",
3
- "version": "11.6.0",
3
+ "version": "11.6.1",
4
4
  "description": "serverless telegram bot on cf workers",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",