iobroker.telegram 1.12.0 → 1.12.2

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.
package/README.md CHANGED
@@ -706,6 +706,9 @@ Before sending it to `telegram.INSTANCE.communicate.responseJson you need to str
706
706
  -->
707
707
 
708
708
  ## Changelog
709
+ ### 1.12.2 (2022-04-01)
710
+ * (Apollon77) Fix crash cases reported by Sentry
711
+
709
712
  ### 1.12.0 (2022-03-21)
710
713
  * (Apollon77) Add new JSON states communication.responseJson and communication.responseSilentJson to also accept json structures (stringified!) to send messages
711
714
  * (Apollon77) Try to prevent adapter crashes when internet is not available
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "telegram",
4
- "version": "1.12.0",
4
+ "version": "1.12.2",
5
5
  "news": {
6
+ "1.12.2": {
7
+ "en": "Fix crash cases reported by Sentry",
8
+ "de": "Von Sentry gemeldete Absturzfälle beheben",
9
+ "ru": "Исправить случаи сбоев, о которых сообщил Sentry",
10
+ "pt": "Corrigir casos de travamento relatados pelo Sentinela",
11
+ "nl": "Herstel crashgevallen gemeld door Sentry",
12
+ "fr": "Correction des cas de plantage signalés par Sentry",
13
+ "it": "Risolvi i casi di crash segnalati da Sentry",
14
+ "es": "Solucionar casos de fallas informados por Sentry",
15
+ "pl": "Napraw przypadki awarii zgłoszone przez Sentry",
16
+ "zh-cn": "修复 Sentry 报告的崩溃案例"
17
+ },
6
18
  "1.12.0": {
7
19
  "en": "Add new JSON states communication.responseJson and communication.responseSilentJson to also accept json structures (stringified!) to send messages\nTry to prevent adapter crashes when internet is not available \nAdd Sentry for crash reporting",
8
20
  "de": "Fügen Sie die neuen JSON-Zustände communication.responseJson und communication.responseSilentJson hinzu, um auch JSON-Strukturen (stringifiziert!) zum Senden von Nachrichten zu akzeptieren\nVersuchen Sie, Adapterabstürze zu verhindern, wenn das Internet nicht verfügbar ist\nFügen Sie Sentry für Absturzberichte hinzu",
@@ -74,18 +86,6 @@
74
86
  "es": "Añadida la opción de no autenticar a los nuevos usuarios.\nSe agregó la opción para deshabilitar los mensajes del sistema para usuarios específicos.",
75
87
  "pl": "Dodano opcję, aby nie uwierzytelniać nowych użytkowników\nDodano opcję wyłączenia wiadomości systemowych dla określonych użytkowników",
76
88
  "zh-cn": "添加了不对新用户进行身份验证的选项\n添加了禁用特定用户的系统消息的选项"
77
- },
78
- "1.8.3": {
79
- "en": "corrected bug with many simultaneous requests \nformatting\nimplemented editMessageMedia and editMessageCaption\nEncrypt token \nCorrected error with password\nCorrected error with boolean easy controls",
80
- "de": "Fehler mit vielen gleichzeitigen Anfragen behoben\nFormatierung\neditMessageMedia und editMessageCaption implementiert\nToken verschlüsseln\nFehler mit Passwort behoben\nFehler mit booleschen einfachen Steuerelementen korrigiert",
81
- "ru": "исправлена ошибка с множеством одновременных запросов\nформатирование\nреализованы editMessageMedia и editMessageCaption\nЗашифровать токен\nИсправлена ошибка с паролем\nИсправлена ошибка с помощью простых логических элементов управления",
82
- "pt": "bug corrigido com muitas solicitações simultâneas\nformatação\nimplementado editMessageMedia e editMessageCaption\nCriptografar token\nErro corrigido com senha\nErro corrigido com controles fáceis booleanos",
83
- "nl": "bug gecorrigeerd met veel gelijktijdige verzoeken\nopmaak\ngeïmplementeerd editMessageMedia en editMessageCaption\nVersleutel token\nFout gecorrigeerd met wachtwoord\nFout gecorrigeerd met boolean easy controls",
84
- "fr": "bug corrigé avec de nombreuses requêtes simultanées\nmise en page\nimplémenté editMessageMedia et editMessageCaption\nChiffrer le jeton\nErreur corrigée avec le mot de passe\nErreur corrigée avec des commandes simples booléennes",
85
- "it": "bug corretto con molte richieste simultanee\nformattazione\nimplementato editMessageMedia e editMessageCaption\nCrittografa il token\nErrore corretto con password\nErrore corretto con controlli booleani facili",
86
- "es": "error corregido con muchas solicitudes simultáneas\nformateo\nimplementado editMessageMedia y editMessageCaption\nCifrar token\nError corregido con contraseña\nError corregido con controles booleanos fáciles",
87
- "pl": "poprawiony błąd z wieloma jednoczesnymi żądaniami\nformatowanie\nzaimplementowano editMessageMedia i editMessageCaption\nZaszyfruj token\nPoprawiony błąd z hasłem\nPoprawiony błąd z łatwymi kontrolkami boolowskimi",
88
- "zh-cn": "修正了许多同时请求的错误\n格式化\n实现了 editMessageMedia 和 editMessageCaption\n加密令牌\n更正密码错误\n使用布尔型简单控件更正错误"
89
89
  }
90
90
  },
91
91
  "title": "Telegram",
package/main.js CHANGED
@@ -85,8 +85,9 @@ function startAdapter(options) {
85
85
  error: (err) => {
86
86
  // Identify unhandled errors originating from callbacks in scripts
87
87
  // These are not caught by wrapping the execution code in try-catch
88
- if (err && typeof err.stack === 'string') {
89
- if (err.includes('getaddrinfo') || err.includes('api.telegram.org') || err.includes('EAI_AGAIN')) {
88
+ if (err ) {
89
+ const errStr = err.toString();
90
+ if (errStr.includes('getaddrinfo') || errStr.includes('api.telegram.org') || errStr.includes('EAI_AGAIN')) {
90
91
  return true;
91
92
  }
92
93
  }
@@ -292,11 +293,19 @@ function startAdapter(options) {
292
293
  if (state) {
293
294
  if (!state.ack) {
294
295
  if (id.endsWith('communicate.response')) {
296
+ if (typeof state.val === 'object') {
297
+ adapter.log.error(`communicate.response only supports passing a message to send as string. You provided ${JSON.stringofy(state.val)}. Please use "communicate.responseJson" instead with a stringified JSON object!`);
298
+ return;
299
+ }
295
300
  // Send to someone this message
296
301
  sendMessage(state.val)
297
302
  .then(data => adapter.setState('communicate.response', state.val, true));
298
303
  } else
299
304
  if (id.endsWith('communicate.responseSilent')) {
305
+ if (typeof state.val === 'object') {
306
+ adapter.log.error(`communicate.responseSilent only supports passing a message to send as string. You provided ${JSON.stringofy(state.val)}. Please use "communicate.responseSilentJson" instead with a stringified JSON object!`);
307
+ return;
308
+ }
300
309
  // Send to someone this message
301
310
  sendMessage(state.val, null, null, {disable_notification: true})
302
311
  .then(data => adapter.setState('communicate.responseSilent', state.val, true));
@@ -308,7 +317,7 @@ function startAdapter(options) {
308
317
  sendMessage(val)
309
318
  .then(data => adapter.setState('communicate.responseJson', state.val, true));
310
319
  } catch (err) {
311
- adapter.log.error(`could not parse Json in responseJon state: ${err.message}`);
320
+ adapter.log.error(`could not parse Json in communicate.responseJon state: ${err.message}`);
312
321
  }
313
322
  } else
314
323
  if (id.endsWith('communicate.responseSilentJson')) {
@@ -318,7 +327,7 @@ function startAdapter(options) {
318
327
  sendMessage(val, null, null, {disable_notification: true})
319
328
  .then(data => adapter.setState('communicate.responseSilent', state.val, true));
320
329
  } catch (err) {
321
- adapter.log.error(`could not parse Json in responseSilentJon state: ${err.message}`);
330
+ adapter.log.error(`could not parse Json in communicate.responseSilentJon state: ${err.message}`);
322
331
  }
323
332
  }
324
333
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.telegram",
3
3
  "description": "The adapter allows to send and receive telegram messages from ioBroker and to be a broker.",
4
- "version": "1.12.0",
4
+ "version": "1.12.2",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "homepage": "https://github.com/iobroker-community-adapters/ioBroker.telegram",
7
7
  "repository": {