Skip to content

Commit

Permalink
fix: humanize wasn't showing cause properly
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Oct 27, 2022
1 parent 5d79cb4 commit 63775e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/k16/gx/beta/errors.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
:always (into (filter (fn [[_ v]] v) *err-ctx*))
message (assoc :message message)
internal-data (assoc :internal-data internal-data)
cause (update :causes conj cause))))
cause (update :causes conj {:title (ex-message cause)
:data (ex-data cause)
:exception cause}))))

(defn throw-gx-err
([message]
Expand Down Expand Up @@ -82,6 +84,7 @@

(defn humanize-error
[{:keys [node-key signal-key message causes]} & rest-of-error]
(println message causes)
(let [rest-of-error (filter seq rest-of-error)]
(apply str (concat [(or message "Error") ": "
(tokenize "node = " node-key
Expand Down
2 changes: 2 additions & 0 deletions test/k16/gx/beta/async_processor_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
:my-component
:causes
first
:exception
(ex-data))
:cljs (-> (gx/failures s)
:my-component
:causes
first
:exception
(ex-data))))))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
Expand Down
2 changes: 1 addition & 1 deletion test/k16/gx/beta/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -636,5 +636,5 @@
(let [{:keys [error-type causes] :as failures} (:comp (gx/failures started))]
(is (= :props-validation error-type))
(is (= ":malli.core/invalid-schema {:schema :bar}"
(-> causes first ex-message))))))))
(-> causes first :title))))))))

1 comment on commit 63775e4

@vercel
Copy link

@vercel vercel bot commented on 63775e4 Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gx – ./

gx-kepler16.vercel.app
gx-git-master-kepler16.vercel.app
gx.kepler16.com

Please sign in to comment.