From c0fb108e06d32224653164a98222b0de5ed30223 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 26 Jan 2021 12:56:57 +0100 Subject: [PATCH] :sparkles: Minor improvements on error reporting. --- backend/deps.edn | 2 +- backend/src/app/http.clj | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/deps.edn b/backend/deps.edn index 62b74cf14..8d1310980 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -33,7 +33,7 @@ io.lettuce/lettuce-core {:mvn/version "5.2.2.RELEASE"} java-http-clj/java-http-clj {:mvn/version "0.4.1"} - info.sunng/ring-jetty9-adapter {:mvn/version "0.14.1"} + info.sunng/ring-jetty9-adapter {:mvn/version "0.14.2"} seancorfield/next.jdbc {:mvn/version "1.1.613"} metosin/reitit-ring {:mvn/version "0.5.10"} metosin/jsonista {:mvn/version "0.3.0"} diff --git a/backend/src/app/http.clj b/backend/src/app/http.clj index a3a0b36b8..927c7f867 100644 --- a/backend/src/app/http.clj +++ b/backend/src/app/http.clj @@ -10,6 +10,7 @@ (ns app.http (:require [app.common.data :as d] + [app.common.exceptions :as ex] [app.common.spec :as us] [app.common.uuid :as uuid] [app.config :as cfg] @@ -104,11 +105,16 @@ (try (handler request) (catch Exception e - (let [cdata (errors/get-error-context request e)] - (errors/update-thread-context! cdata) - (log/errorf e "Unhandled exception: %s (id: %s)" (ex-message e) (str (:id cdata))) - {:status 500 - :body "internal server error"})))))) + (try + (let [cdata (errors/get-error-context request e)] + (errors/update-thread-context! cdata) + (log/errorf e "Unhandled exception: %s (id: %s)" (ex-message e) (str (:id cdata))) + {:status 500 + :body "internal server error"}) + (catch Exception e + (log/errorf e "Unhandled exception: %s" (ex-message e)) + {:status 500 + :body "internal server error"}))))))) (defn- create-router [{:keys [session rpc google-auth gitlab-auth github-auth metrics ldap-auth storage svgparse assets] :as cfg}]