I'm getting this error from TSLint and I'm trying to understand why it is complaining about.
I have a function which invokes another method which returns a promise but the first function does not return the promise because it just waits for it to finish and update an internal state.
I've simplified it to this function and just use Q()
to simulate an invocation that returns a promise.
export function DoSomethingAsync(): void {
Q().then(r => {
console.log('test');
}).catch(err => {
log.error("wow");
}).finally(() => {
log.info("at finally")
});
}
When I run tslint
on my project now I'm getting the following error:
ERROR: C:/dev/local_cache_service.ts[31, 5]: Promises must be handled appropriately
If I remove the finally
call tslint passes without errors.
export function DoSomethingAsync(): void {
Q().then(r => {
console.log('test');
}).catch(err => {
log.error("wow");
});
}
When I create the same function on a seed typescript project this behavior does not reproduce...