Skip to content

Commit

Permalink
Only set default uncaught exception handler for import
Browse files Browse the repository at this point in the history
  • Loading branch information
wardle committed Sep 19, 2023
1 parent 17fd09a commit 7112aba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/com/eldrix/hermes/cmd/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
(doseq [dep problem-deps]
(log/warn "module dependency mismatch" dep))))

(defn set-default-uncaught-exception-handler []
(Thread/setDefaultUncaughtExceptionHandler
(reify Thread$UncaughtExceptionHandler
(uncaughtException [_ thread ex]
(log/error ex "Uncaught exception on" (.getName thread))))))

(defn import-from [{:keys [db]} args]
(set-default-uncaught-exception-handler)
(let [dirs (if (zero? (count args)) ["."] args)]
(hermes/import-snomed db dirs)))

Expand Down Expand Up @@ -132,14 +139,7 @@
(f opts args)
(exit 1 "ERROR: not implemented ")))

(defn set-default-uncaught-exception-handler []
(Thread/setDefaultUncaughtExceptionHandler
(reify Thread$UncaughtExceptionHandler
(uncaughtException [_ thread ex]
(log/error ex "Uncaught exception on" (.getName thread))))))

(defn -main [& args]
(set-default-uncaught-exception-handler)
(let [{:keys [cmds options arguments summary errors warnings]} (cli/parse-cli args)]
(doseq [warning warnings] (log/warn warning))
(cond
Expand Down

0 comments on commit 7112aba

Please sign in to comment.