Skip to content

Commit

Permalink
fix: clj/cljs error wrap consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Jul 14, 2022
1 parent 3b363e1 commit e037b33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/k16/gx/beta/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
[e arg-map]
(gx.err/gx-err-data "Signal processor error"
{:ex-message (impl/error-message e)
:ex (or (ex-data e) e)
:ex e
:args arg-map}))

#?(:cljs
Expand All @@ -254,7 +254,7 @@
(try
[nil @(p/do (processor arg-map))]
(catch Throwable e
[(wrap-error e arg-map) nil]))))
[(wrap-error (or (ex-cause e) e) arg-map) nil]))))

#?(:cljs
(defn- run-processor
Expand Down
4 changes: 2 additions & 2 deletions test/k16/gx/beta/async_processor_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
:my-component
:internal-data
:ex
(ex-cause)
(ex-data))
:cljs (-> (gx/failures s)
:my-component
:internal-data
:ex)))))
:ex
(ex-data))))))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(deftest async-rejected-component-test
Expand Down
14 changes: 4 additions & 10 deletions test/k16/gx/beta/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
gx-norm (gx/normalize {:graph graph
:context gx/default-context})
expect (list {:internal-data
{:ex-message "java.lang.ArithmeticException: Divide by zero; Divide by zero",
{:ex-message "Divide by zero",
:args {:props {:z 1}, :value nil, :state :uninitialised, :instance nil}},
:message "Signal processor error",
:error-type :node-signal,
Expand All @@ -277,14 +277,8 @@
:signal-key :gx/start}
{:internal-data
{:ex-message
(str "java.lang.ClassCastException: class "
"clojure.lang.Keyword cannot be cast "
"to class java.lang.Number (clojure."
"lang.Keyword is in unnamed module of "
"loader 'app'; java.lang.Number is in "
"module java.base of loader 'bootstrap'); "
"class clojure.lang.Keyword cannot be cast "
"to class java.lang.Number (clojure.lang."
(str "class clojure.lang.Keyword cannot be cast"
" to class java.lang.Number (clojure.lang."
"Keyword is in unnamed module of loader "
"'app'; java.lang.Number is in module "
"java.base of loader 'bootstrap')"),
Expand Down Expand Up @@ -358,7 +352,7 @@
:node-contents '(gx/ref :b),
:signal-key :gx/start}
{:internal-data
{:ex-message "java.lang.ArithmeticException: Divide by zero; Divide by zero",
{:ex-message "Divide by zero",
:args {:props {:a 1}, :state :uninitialised, :value nil, :instance nil}},
:message "Signal processor error",
:error-type :node-signal,
Expand Down

1 comment on commit e037b33

@vercel
Copy link

@vercel vercel bot commented on e037b33 Jul 14, 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.