From 0feaa1af8f74d75efd253360f8489d81921eb4d1 Mon Sep 17 00:00:00 2001 From: Siddharth Banga <91724657+VOSID8@users.noreply.github.com> Date: Tue, 2 Apr 2024 03:28:56 +0530 Subject: [PATCH] Added few error loggers --- .vscode/settings.json | 5 +++++ .../main/scala/scaladex/client/ActiveNavObserver.scala | 10 ++++++++-- project/Docker.scala | 4 +++- project/Elasticsearch.scala | 1 + project/Postgres.scala | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..32cfc61d2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.watcherExclude": { + "**/target": true + } +} \ No newline at end of file diff --git a/modules/webclient/src/main/scala/scaladex/client/ActiveNavObserver.scala b/modules/webclient/src/main/scala/scaladex/client/ActiveNavObserver.scala index 4d49fa00c..09e898f5c 100644 --- a/modules/webclient/src/main/scala/scaladex/client/ActiveNavObserver.scala +++ b/modules/webclient/src/main/scala/scaladex/client/ActiveNavObserver.scala @@ -30,8 +30,14 @@ object ActiveNavObserver { // ignore the observed entry and update all sections instead debounceUpdate = timers.setTimeout(150) { for ((section, navItem) <- sectionsAndNavItem) - if (isInViewport(section)) navItem.classList.add("active") - else navItem.classList.remove("active") + if (isInViewport(section)) { + navItem.classList.add("active") + println(s"Section ${section.getAttribute("id")} is in viewport") + } + else { + navItem.classList.remove("active") + println(s"Section ${section.getAttribute("id")} is out of viewport") + } } } diff --git a/project/Docker.scala b/project/Docker.scala index 57dc1e7cd..41e3c71dc 100644 --- a/project/Docker.scala +++ b/project/Docker.scala @@ -10,6 +10,8 @@ object Docker { def kill(containerId: String): Unit = try client.killContainerCmd(containerId).exec() catch { - case _: Throwable => () + case e: Throwable => + // Log the error + println(s"Error killing container $containerId: ${e.getMessage}") } } diff --git a/project/Elasticsearch.scala b/project/Elasticsearch.scala index 51ca9ef76..69efb9db1 100644 --- a/project/Elasticsearch.scala +++ b/project/Elasticsearch.scala @@ -81,6 +81,7 @@ object Elasticsearch extends AutoPlugin { container.getFirstMappedPort() } catch { case e: Throwable => + logger.error("Error starting Elasticsearch container:", e) container.stop() throw e } diff --git a/project/Postgres.scala b/project/Postgres.scala index 54773ee3e..76939ff98 100644 --- a/project/Postgres.scala +++ b/project/Postgres.scala @@ -92,6 +92,7 @@ object Postgres extends AutoPlugin { container.getFirstMappedPort() } catch { case e: Throwable => + logger.error("Error starting PostgreSQL container:", e) container.close() throw e }