mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 01:45:14 +02:00
🐛 Don't raise exception when profile is not found.
This commit is contained in:
parent
b7ba3098ae
commit
d2d4090e27
2 changed files with 12 additions and 9 deletions
|
@ -37,10 +37,15 @@
|
|||
|
||||
(sv/defmethod ::profile {:auth false}
|
||||
[{:keys [pool] :as cfg} {:keys [profile-id] :as params}]
|
||||
(if profile-id
|
||||
(retrieve-profile pool profile-id)
|
||||
{:id uuid/zero
|
||||
:fullname "Anonymous User"}))
|
||||
|
||||
;; We need to return the anonymous profile object in two cases, when
|
||||
;; no profile-id is in session, and when db call raises not found. In all other
|
||||
;; cases we need to reraise the exception.
|
||||
(or (ex/try*
|
||||
#(some->> profile-id (retrieve-profile pool))
|
||||
#(when (not= :not-found (:type (ex-data %))) (throw %)))
|
||||
{:id uuid/zero
|
||||
:fullname "Anonymous User"}))
|
||||
|
||||
(def ^:private sql:default-profile-team
|
||||
"select t.id, name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue