Skip to content

Commit

Permalink
better safer solution to reading result of ns form that returns js
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Hauman committed Aug 12, 2018
1 parent e0f6c64 commit 723f6e8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sidecar/src/figwheel_sidecar/components/figwheel_server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

(defn read-msg [data]
(try
(let [msg
(binding [*read-eval* false
*default-data-reader-fn* (fn [tag res] res)]
(read-string data))]
(let [msg (edn/read-string {:readers {'js identity 'object identity}} data)]
(if (and (map? msg) (:figwheel-event msg)) msg {}))
(catch Exception e
(println "Figwheel: message from client couldn't be read!")
(println (Throwable->map e))
{})))

(defn validate-file-selected-msg [{:keys [file-name file-line file-column] :as msg}]
Expand Down

0 comments on commit 723f6e8

Please sign in to comment.