@ -50,24 +50,26 @@ const _deprecatedMessageTypes = [
] ;
] ;
// Enable Promise cancellation.
if ( ! process . env . NTBA _FIX _319 ) {
try {
// Enable Promise cancellation.
const msg =
try {
'Automatic enabling of cancellation of promises is deprecated.\n' +
const msg =
'In the future, you will have to enable it yourself.\n' +
'Automatic enabling of cancellation of promises is deprecated.\n' +
'See https://github.com/yagop/node-telegram-bot-api/issues/319.' ;
'In the future, you will have to enable it yourself.\n' +
deprecate ( msg ) ;
'See https://github.com/yagop/node-telegram-bot-api/issues/319.' ;
Promise . config ( {
deprecate ( msg ) ;
cancellation : true ,
Promise . config ( {
} ) ;
cancellation : true ,
} catch ( ex ) {
} ) ;
/* eslint-disable no-console */
} catch ( ex ) {
const msg =
/* eslint-disable no-console */
'error: Enabling Promise cancellation failed.\n' +
const msg =
' Temporary fix is to load/require this library as early as possible before using any Promises.' ;
'error: Enabling Promise cancellation failed.\n' +
console . error ( msg ) ;
' Temporary fix is to load/require this library as early as possible before using any Promises.' ;
throw ex ;
console . error ( msg ) ;
/* eslint-enable no-console */
throw ex ;
/* eslint-enable no-console */
}
}
}