Improve worker error handling

Use the global error handlers for handle
also the worker errors.
This commit is contained in:
Andrey Antukh 2022-03-22 17:24:36 +01:00 committed by Alonso Torres
parent 9582cc0211
commit b87e3c22b3
2 changed files with 9 additions and 9 deletions

View file

@ -52,10 +52,13 @@
(reply [result]
(post {:payload result}))
(reply-error [err]
(.error js/console "error" (pr-str err))
(post {:error {:data (ex-data err)
:message (ex-message err)}}))
(reply-error [cause]
(if (map? cause)
(post {:error cause})
(post {:error {:type :unexpected
:code :unhandled-error-on-worker
:hint (ex-message cause)
:data (ex-data cause)}})))
(reply-completed
([] (reply-completed nil))