Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use bean and ->clj on objects like js/Error? #90

Open
introom opened this issue Apr 16, 2022 · 3 comments
Open

How to use bean and ->clj on objects like js/Error? #90

introom opened this issue Apr 16, 2022 · 3 comments

Comments

@introom
Copy link

introom commented Apr 16, 2022

For now, for the following code:

(def e (js/Error. "test string"))
;; 1
(bean/e) 
;; 2
(->clj/e)
  1. gives
{:clojure$core$protocols$Datafiable$ #js {}, :clojure$core$protocols$Datafiable$datafy$arity$1 #object[Function]
  1. gives
#object[Error Error: test string]

Would be better if it can give things like

{"message":foo,  "line":foo,  "column":foo,  "stack":foo}
@mfikes
Copy link
Owner

mfikes commented Apr 16, 2022

@introom
Copy link
Author

introom commented Apr 16, 2022

Not sure on the details. Isn't it possible to use all the possible keys from an object to form a bean? So it will work not only in the specific case of Error->map ?

@mfikes
Copy link
Owner

mfikes commented Apr 17, 2022

@introom One issue here is that js-keys returns an empty array when applied to a js/Error object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants