cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
juhoteperi 2020-11-20T09:03:30.076900Z

I'm trying to show easy to understand error to a library users about moved function. Is creating a macro with same name as the function, and throwing :cljs/analysis-error at all a good idea?

(defn- source-info [env]
  (when (:line env)
    {:file (ana-api/current-file)
     :line (:line env)
     :column (:column env)}))

(defmacro render
  [& body]
  (throw (ex-info "reagent.core/render function was moved to reagent.dom namespace in Reagent v1.0"
                  (assoc (source-info &env) :tag :cljs/analysis-error)))
  nil)

dnolen 2020-11-20T15:57:37.077100Z

I don't think so

dnolen 2020-11-20T15:58:00.077500Z

I think analysis errors should be reserved for compiler problems

dnolen 2020-11-20T15:58:27.078Z

just write a regular function, and throw a reagent error

dnolen 2020-11-20T15:58:37.078300Z

this is how core.async deals w/ <! etc. outside of go block