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

Only warn about init function being unset when it actually isn't set #151

Merged
merged 6 commits into from
Sep 27, 2017
22 changes: 16 additions & 6 deletions library/src/doo/runner.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,22 @@

;; Karma starts the runner with arguments
(defn ^:export run! [a]
(try
(*main-cli-fn* a)
(catch :default e
(println "WARNING: doo's init function was not set")
(println e)
(exit! false))))
(if-not (fn? *main-cli-fn*)
(do (println "WARNING: doo's init function was not set or is not a function")
(exit! false))
(try
(*main-cli-fn* a)
(catch :default e
(println)
(println "ERROR: Exception outside tests:")
(println "ERROR:" e)
(if (.hasOwnProperty e "stack")
(do (println)
(println "ERROR: Stacktrace:")
(println "ERROR:" (.-stack e)))
(do (println)
(println "ERROR: No stacktrace available.")))
(exit! false)))))

(defn set-entry-point!
"Sets the function to be run when starting the script"
Expand Down