2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-28 21:07:39 +00:00

src/telegram: Use $NTBA_FIX_319 to apply fix for #319

Notes:

  The permanent fix introduces backwards-incompatible changes, which
  require a major version bump. Until we release v1,
  environment variable `${NTBA_FIX_319}` can be used to apply
  the fix.

References:

  * BR: https://github.com/yagop/node-telegram-bot-api/issues/319
This commit is contained in:
GochoMugo 2017-08-25 18:51:51 +03:00
parent ef48af49f5
commit f4f015a621
No known key found for this signature in database
GPG Key ID: 7B6A01CB57AA39E4

View File

@ -50,8 +50,9 @@ const _deprecatedMessageTypes = [
];
// Enable Promise cancellation.
try {
if (!process.env.NTBA_FIX_319) {
// Enable Promise cancellation.
try {
const msg =
'Automatic enabling of cancellation of promises is deprecated.\n' +
'In the future, you will have to enable it yourself.\n' +
@ -60,7 +61,7 @@ try {
Promise.config({
cancellation: true,
});
} catch (ex) {
} catch (ex) {
/* eslint-disable no-console */
const msg =
'error: Enabling Promise cancellation failed.\n' +
@ -68,6 +69,7 @@ try {
console.error(msg);
throw ex;
/* eslint-enable no-console */
}
}