From a97d68cf546b0dfcd70e1523a0387b4258485cb2 Mon Sep 17 00:00:00 2001 From: powerkimhub Date: Sat, 20 Jul 2024 18:05:28 +0900 Subject: [PATCH] Add exception handling for error capability --- .../html/priceinfo-request-template.html | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/api-runtime/rest-runtime/admin-web/html/priceinfo-request-template.html b/api-runtime/rest-runtime/admin-web/html/priceinfo-request-template.html index 61493336c..a8e214343 100644 --- a/api-runtime/rest-runtime/admin-web/html/priceinfo-request-template.html +++ b/api-runtime/rest-runtime/admin-web/html/priceinfo-request-template.html @@ -312,7 +312,11 @@

Multi-Cloud Price Info

if (filterList) { apiURL += ` -H 'Content-Type: application/json' -d '${filterList}'` } - parent.frames["log_frame"].Log("curl -sX GET http://" + `${hostname}` + ":" + `${port}` + apiURL); + try { + parent.frames["log_frame"].Log("curl -sX GET http://" + `${hostname}` + ":" + `${port}` + apiURL); + } catch (e) { + // Do nothing if error occurs + } let fetchText = 'fetching'; let intervalId = setInterval(() => { @@ -333,17 +337,25 @@

Multi-Cloud Price Info

.then(data => { clearInterval(intervalId); // stop the interval fetchOverlayContent.srcdoc = data; // set the HTML content in the iframe - - // logging the fetch success - parent.frames["log_frame"].Log(" ==> Fetch Success"); + + try { + // logging the fetch success + parent.frames["log_frame"].Log(" ==> Fetch Success"); + } catch (e) { + // Do nothing if error occurs + } }) .catch(error => { console.error('Error:', error); alert(error); clearInterval(intervalId); // when error occurs, stop the interval - // logging the fetch error - parent.frames["log_frame"].Log(" ==> Fetch Error: " + error.message); + try { + // logging the fetch error + parent.frames["log_frame"].Log(" ==> Fetch Error: " + error.message); + } catch (e) { + // Do nothing if error occurs + } }); }