diff --git a/server/model/domain_expiry.js b/server/model/domain_expiry.js index 91d5b54e3..b8d12918b 100644 --- a/server/model/domain_expiry.js +++ b/server/model/domain_expiry.js @@ -10,9 +10,9 @@ const dayjs = require("dayjs"); const cachedFetch = process.env.NODE_ENV ? NodeFetchCache.create({ - // cache for 8h - cache: new MemoryCache({ ttl: 1000 * 60 * 60 * 8 }), - }) + // cache for 8h + cache: new MemoryCache({ ttl: 1000 * 60 * 60 * 8 }), + }) : fetch; /** @@ -176,14 +176,6 @@ class DomainExpiry extends BeanModel { const rdap = await getRdapServer(tld.publicSuffix); if (!rdap) { - // Only warn when the monitor actually has domain expiry notifications enabled. - // The edit monitor page calls this method frequently while the user is typing. - if (Boolean(monitor.domainExpiryNotification)) { - log.warn( - "domain_expiry", - `Domain expiry unsupported for '.${tld.publicSuffix}' because its RDAP endpoint is not listed in the IANA database.` - ); - } throw new TranslatableError("domain_expiry_unsupported_unsupported_tld_no_rdap_endpoint", { publicSuffix: tld.publicSuffix, }); diff --git a/server/model/monitor.js b/server/model/monitor.js index 01d655f23..4ff4f098a 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -694,11 +694,11 @@ class Monitor extends BeanModel { } throw new Error( bean.msg + - ", but keyword is " + - (keywordFound ? "present" : "not") + - " in [" + - data + - "]" + ", but keyword is " + + (keywordFound ? "present" : "not") + + " in [" + + data + + "]" ); } } else if (this.type === "json-query") { @@ -816,7 +816,7 @@ class Monitor extends BeanModel { PING_GLOBAL_TIMEOUT_DEFAULT, PING_PER_REQUEST_TIMEOUT_DEFAULT ); - } catch (_) {} + } catch (_) { } } else { throw new Error("Server not found on Steam"); } @@ -1059,7 +1059,15 @@ class Monitor extends BeanModel { log.debug("monitor", `Failed getting expiration date for domain ${supportInfo.domain}`); } } catch (error) { - // purposely not logged due to noise. Is accessible via checkMointor + if ( + error.message === "domain_expiry_unsupported_unsupported_tld_no_rdap_endpoint" && + Boolean(this.domainExpiryNotification) + ) { + log.warn( + "domain_expiry", + `Domain expiry unsupported for '.${error.meta.publicSuffix}' because its RDAP endpoint is not listed in the IANA database.` + ); + } } } @@ -1319,7 +1327,7 @@ class Monitor extends BeanModel { } else { log.debug("monitor", "Not valid object"); } - } catch (e) {} + } catch (e) { } } tlsInfoBean.info_json = JSON.stringify(checkCertificateResult); @@ -1407,7 +1415,7 @@ class Monitor extends BeanModel { if (domain?.expiry) { io.to(userID).emit("domainInfo", monitorID, domain.daysRemaining, new Date(domain.expiry)); } - } catch (e) {} + } catch (e) { } } /**