From 03546b7c3cb12289ae0dd6372987d9f1bc12d78f Mon Sep 17 00:00:00 2001 From: hidetak Date: Mon, 4 Mar 2024 17:33:21 +0900 Subject: [PATCH] fixed to catch errors when servient termination fails --- node-red-node-wot/src/servients/servient-manager.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/node-red-node-wot/src/servients/servient-manager.ts b/node-red-node-wot/src/servients/servient-manager.ts index 3c82061..99756ee 100644 --- a/node-red-node-wot/src/servients/servient-manager.ts +++ b/node-red-node-wot/src/servients/servient-manager.ts @@ -39,12 +39,14 @@ export default class ServientManager { }, 10000) // If it does not end after 10 seconds, it is considered to be finished. try { await servientWrapper.endServient() + console.debug("[debug] servient ended. id: " + id) + clearTimeout(timeoutId) + resolve() } catch (err) { + console.debug("[debug] failed to end servient. id: " + id + " error: " + err.toString()) + clearTimeout(timeoutId) reject(err) } - console.debug("[debug] servient ended. id: " + id) - clearTimeout(timeoutId) - resolve() }) }