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:
parent
068a92365e
commit
37eef77d4b
@ -549,10 +549,10 @@ export class KubeApi<T extends KubeObject> {
|
|||||||
logger.info(`[KUBE-API] system suspended, abort watching of ${watchUrl}...`);
|
logger.info(`[KUBE-API] system suspended, abort watching of ${watchUrl}...`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (opts.abortController) {
|
if (typeof opts.abortController?.abort === "function") {
|
||||||
opts.abortController.abort?.();
|
opts.abortController.abort();
|
||||||
} else {
|
} else if (typeof abort === "function") {
|
||||||
abort?.();
|
abort();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`[KUBE-API] error aborting watch (${watchId})`, error);
|
logger.error(`[KUBE-API] error aborting watch (${watchId})`, error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user