boot-clj / boot-cljs

Boot task to compile ClojureScript programs.
Eclipse Public License 1.0
176 stars 40 forks source link

error message on compilation failure #110

Closed thosmos closed 8 years ago

thosmos commented 9 years ago

With boot-cljs "1.7.170-3" I've been getting the following kind of error during compilation which doesn't have any hint as to where the exception is throwing from:

Compiling ClojureScript...
• ui/js/app.js
adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: No such namespace: take2.common.routes, could not locate take2/common/routes.cljs, take2/common/routes.cljc, or Closure namespace "take2.common.routes"
    data: {:tag :cljs/analysis-error, :from :boot-cljs}
               clojure.core/ex-info       core.clj: 4593
    adzerk.boot-cljs.impl/handle-ex       impl.clj:   60
 adzerk.boot-cljs.impl/compile-cljs       impl.clj:   97
                                ...                     
                 clojure.core/apply       core.clj:  630
              boot.pod/eval-fn-call        pod.clj:  184
                  boot.pod/call-in*        pod.clj:  191
                                ...                     
                  boot.pod/call-in*        pod.clj:  194
           adzerk.boot-cljs/compile  boot_cljs.clj:   71
      adzerk.boot-cljs/compile-1/fn  boot_cljs.clj:  125
clojure.core/binding-conveyor-fn/fn       core.clj: 1916
                                ...                     
Elapsed time: 29.095 sec
martinklepsch commented 9 years ago

@thos37 did you figure out what change initially caused this exception?

This seems to be related to the exception handling in boot-cljs but looking at the code it seems nothing of an exceptions message should get lost: https://github.com/adzerk-oss/boot-cljs/blob/master/src/adzerk/boot_cljs/impl.clj#L39

thosmos commented 9 years ago

Hmm, strange. I thought problem was an invalid reference inside of my app.core's namespace require. But I just tried putting it back in, and got a reasonable error:

   clojure.lang.ExceptionInfo: Could not locate take2/common/routes__init.class or take2/common/routes.clj on classpath.
    data: {:file "server/router.clj", :line 1}

If it happens again, I'll post here with more details.

Deraen commented 9 years ago

Clojurescript compiler throws different exceptions when doing the first compilation and when doing recompilation.

Not sure if in this case the exception from first compilation just doesn't have the location metadata or if it's lost somewhere.

There could still be some problem in boot-cljs exception handling because the stacktrace should contain the original stacktrace from clojurescript compiler, not the stacktrace of manually rethrown exception.

thosmos commented 9 years ago

Oops, sorry that previous "reasonable" error was because I put the invalid reference back into my clojure code instead of my cljs code.

Here's the CLJS code

(ns ui.main
  (:require [take2.common.routes :refer [routes]]))

Here's the error:

➜  take2-clj git:(558f4bc) ✗ boot cljs
Compiling ClojureScript...
• js/app.js
                                     clojure.lang.ExceptionInfo: clojure.lang.ExceptionInfo: No such namespace: take2.common.routes, could not locate take2/common/routes.cljs, take2/common/routes.cljc, or Closure namespace "take2.common.routes" {:tag :cljs/analysis-error, :from :boot-cljs}
    data: {:file
           "/var/folders/00/1_302jq932lc58ljwn6rwrvr0000gn/T/boot.user1585566588115876932.clj",
           :line 49}
                        java.util.concurrent.ExecutionException: clojure.lang.ExceptionInfo: No such namespace: take2.common.routes, could not locate take2/common/routes.cljs, take2/common/routes.cljc, or Closure namespace "take2.common.routes" {:tag :cljs/analysis-error, :from :boot-cljs}
adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: No such namespace: take2.common.routes, could not locate take2/common/routes.cljs, take2/common/routes.cljc, or Closure namespace "take2.common.routes"
    data: {:tag :cljs/analysis-error, :from :boot-cljs}
               clojure.core/ex-info       core.clj: 4593
    adzerk.boot-cljs.impl/handle-ex       impl.clj:   60
 adzerk.boot-cljs.impl/compile-cljs       impl.clj:   97
                                ...                     
                 clojure.core/apply       core.clj:  630
              boot.pod/eval-fn-call        pod.clj:  184
                  boot.pod/call-in*        pod.clj:  191
                                ...                     
                  boot.pod/call-in*        pod.clj:  194
           adzerk.boot-cljs/compile  boot_cljs.clj:   71
      adzerk.boot-cljs/compile-1/fn  boot_cljs.clj:  125
clojure.core/binding-conveyor-fn/fn       core.clj: 1916
                                ...                     
Deraen commented 8 years ago

I have been able to reproduce this: https://github.com/Deraen/saapas/compare/cljs-issue-110?expand=1

The same happens with :refer-macros. Will look into fixing this.

Deraen commented 8 years ago

And with requiring a non-existing namespace.