Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Don't swallow stacktraces for fatal errors (#83155)

Rodrigo López Dato99490d001328
diff --git a/src/metabase/app_db/update_h2.clj b/src/metabase/app_db/update_h2.clj
index 6b19ff74afe..a0cf7382631 100644
--- a/src/metabase/app_db/update_h2.clj
+++ b/src/metabase/app_db/update_h2.clj
@@ -104,5 +104,5 @@
(try
(update! jdbc-url)
(catch Exception e
- (log/errorf "Failed to update H2 database: %s" (ex-message e))
+ (log/error e "Failed to update H2 database:")
(throw e)))))))
diff --git a/src/metabase/cmd/copy.clj b/src/metabase/cmd/copy.clj
index 365e3175bd7..f471b1c8fd6 100644
--- a/src/metabase/cmd/copy.clj
+++ b/src/metabase/cmd/copy.clj
@@ -200,7 +200,7 @@
(let [{:keys [cols vals]} (objects->columns+values target-db-type chunkk)]
(jdbc/insert-multi! target-db-conn-spec table-name cols vals {:transaction? false}))
(catch SQLException e
- (log/errorf "Error inserting chunk: %s" (ex-message e))
+ (log/error (with-out-str (jdbc/print-sql-exception-chain e)))
(throw e))))
#_{:clj-kondo/ignore [:metabase/discourage-dynamic-vars]}
diff --git a/src/metabase/cmd/core.clj b/src/metabase/cmd/core.clj
index 1a139e294ea..d617a4a70f7 100644
--- a/src/metabase/cmd/core.clj
+++ b/src/metabase/cmd/core.clj
@@ -92,7 +92,7 @@
(println "Dump complete")
(system-exit! 0))
(catch Throwable e
- (log/errorf "Failed to dump application database to H2 file: %s" (ex-message e))
+ (log/error e "Failed to dump application database to H2 file")
(system-exit! 1))))
(defn ^:command reset-password
@@ -249,7 +249,7 @@
(log/info "Encryption key rotation OK.")
(system-exit! 0)
(catch Throwable e
- (log/errorf "ERROR ROTATING KEY: %s" (ex-message e))
+ (log/error e "ERROR ROTATING KEY.")
(system-exit! 1))))
(defn ^:command enable-encryption
@@ -282,7 +282,7 @@
(log/info "Encryption removed OK.")
(system-exit! 0)
(catch Throwable e
- (log/errorf "ERROR REMOVING ENCRYPTION: %s" (ex-message e))
+ (log/error e "ERROR REMOVING ENCRYPTION.")
(system-exit! 1))))
;;; ------------------------------------------------ Validate Commands ----------------------------------------------
diff --git a/src/metabase/core/core.clj b/src/metabase/core/core.clj
index ba66f6f39e2..885c0caa832 100644
--- a/src/metabase/core/core.clj
+++ b/src/metabase/core/core.clj
@@ -289,7 +289,7 @@
(when (config/config-bool :mb-jetty-join)
(.join (server/instance)))
(catch Throwable e
- (log/errorf "Metabase Initialization FAILED: %s" (ex-message e))
+ (log/error e "Metabase Initialization FAILED")
(System/exit 1))))
(defn- run-cmd [cmd init-fn args]
diff --git a/src/metabase/plugins/impl.clj b/src/metabase/plugins/impl.clj
index 6fe68bf01a4..b71e0504925 100644
--- a/src/metabase/plugins/impl.clj
+++ b/src/metabase/plugins/impl.clj
@@ -181,7 +181,7 @@
(try
(register-plugin! reserved-names path)
(catch Throwable e
- (log/errorf "Failed to register plugin %s: %s" (.getFileName path) (ex-message e))))))
+ (log/errorf e "Failed to register plugin %s" (.getFileName path))))))
(defn- bundled-plugin-names
"Names of every bundled (classpath) plugin, whether or not its dependencies are yet satisfied. A bundled
diff --git a/src/metabase/startup/core.clj b/src/metabase/startup/core.clj
index a7802e7e2fe..b0ce87cd47d 100644
--- a/src/metabase/startup/core.clj
+++ b/src/metabase/startup/core.clj
@@ -53,7 +53,7 @@
(try
(f k)
(catch Throwable e
- (log/errorf "Error initializing startup logic %s: %s" k (ex-message e))))))
+ (log/errorf e "Error initializing startup logic %s" k)))))
(defn- run-startup-logic!*
"Run `validation-impls` (each aborts the boot on a throw), then `setup-impls` (throws logged and skipped).
diff --git a/src/metabase/task/impl.clj b/src/metabase/task/impl.clj
index d2fbdddf891..2264255649c 100644
--- a/src/metabase/task/impl.clj
+++ b/src/metabase/task/impl.clj
@@ -79,7 +79,7 @@
(log/info "Initializing task" (u/format-color 'green (name k)) (u/emoji "📆"))
(f k)
(catch Throwable e
- (log/errorf "Error initializing task %s: %s" k (ex-message e))))))
+ (log/errorf e "Error initializing task %s" k)))))
;;; +----------------------------------------------------------------------------------------------------------------+
;;; | STARTING/STOPPING SCHEDULER |