1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Check if abort is a function

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen 2021-11-23 13:35:01 +02:00
parent 068a92365e
commit 37eef77d4b
No known key found for this signature in database
GPG Key ID: 54B44603D251B788

View File

@ -549,10 +549,10 @@ export class KubeApi<T extends KubeObject> {
logger.info(`[KUBE-API] system suspended, abort watching of ${watchUrl}...`);
try {
if (opts.abortController) {
opts.abortController.abort?.();
} else {
abort?.();
if (typeof opts.abortController?.abort === "function") {
opts.abortController.abort();
} else if (typeof abort === "function") {
abort();
}
} catch (error) {
logger.error(`[KUBE-API] error aborting watch (${watchId})`, error);