mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +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:
parent
ef48af49f5
commit
f4f015a621
@ -50,8 +50,9 @@ const _deprecatedMessageTypes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
// Enable Promise cancellation.
|
if (!process.env.NTBA_FIX_319) {
|
||||||
try {
|
// Enable Promise cancellation.
|
||||||
|
try {
|
||||||
const msg =
|
const msg =
|
||||||
'Automatic enabling of cancellation of promises is deprecated.\n' +
|
'Automatic enabling of cancellation of promises is deprecated.\n' +
|
||||||
'In the future, you will have to enable it yourself.\n' +
|
'In the future, you will have to enable it yourself.\n' +
|
||||||
@ -60,7 +61,7 @@ try {
|
|||||||
Promise.config({
|
Promise.config({
|
||||||
cancellation: true,
|
cancellation: true,
|
||||||
});
|
});
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
const msg =
|
const msg =
|
||||||
'error: Enabling Promise cancellation failed.\n' +
|
'error: Enabling Promise cancellation failed.\n' +
|
||||||
@ -68,6 +69,7 @@ try {
|
|||||||
console.error(msg);
|
console.error(msg);
|
||||||
throw ex;
|
throw ex;
|
||||||
/* eslint-enable no-console */
|
/* eslint-enable no-console */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user