From acc0623219977742d15baa6abf4b4e677dec8920 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 30 Jul 2024 16:45:16 +0200 Subject: [PATCH] :sparkles: Add temporal log entry for profile insert conflict --- backend/src/app/rpc/commands/auth.clj | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/src/app/rpc/commands/auth.clj b/backend/src/app/rpc/commands/auth.clj index 50f575755b..68a4edd0d0 100644 --- a/backend/src/app/rpc/commands/auth.clj +++ b/backend/src/app/rpc/commands/auth.clj @@ -286,14 +286,17 @@ (try (-> (db/insert! conn :profile params) (profile/decode-row)) - (catch org.postgresql.util.PSQLException e - (let [state (.getSQLState e)] + (catch org.postgresql.util.PSQLException cause + (let [state (.getSQLState cause)] (if (not= state "23505") - (throw e) - (ex/raise :type :validation - :code :email-already-exists - :hint "email already exists" - :cause e))))))) + (throw cause) + + (do + (l/error :hint "not an error" :cause cause) + (ex/raise :type :validation + :code :email-already-exists + :hint "email already exists" + :cause cause)))))))) (defn create-profile-rels! [conn {:keys [id] :as profile}]