binaryage / dirac

A Chrome DevTools fork for ClojureScript developers
Other
769 stars 30 forks source link

Pause on exceptions not working #70

Closed tslocke closed 6 years ago

tslocke commented 6 years ago

Hi,

Thanks for an amazing project.

Should I expect "Pause on exceptions" (Sources panel) to just work, once Dirac is up and running, or would that need some extra config?

Any suggestions for debugging why it's not working? Hopefully just a config issue.

These are the versions I have in project.clj

  :dependencies [[org.clojure/clojure "1.9.0-beta1"]
                 [org.clojure/clojurescript "1.9.946"]
                 [org.clojure/core.match "0.3.0-alpha4"]
                 [funcool/cuerdas "2.0.4"]
                 [inflections "0.13.0"]
                 [cljsjs/peg "0.8.0-0"]
                 [com.cemerick/double-check "0.6.1"]
                 [org.clojure/tools.nrepl "0.2.13"]
                 [org.clojure/tools.cli "0.3.5"]
                 [com.rpl/specter "0.13.1"]
                 [figwheel "0.5.14"]
                 [binaryage/devtools "0.9.7"]
                 [binaryage/dirac "RELEASE"]]

  :plugins [[lein-cljsbuild "1.1.7"]
            [lein-figwheel "0.5.14"]]

And :repl-options

{:repl-options {:port             8230
                :nrepl-middleware [dirac.nrepl/middleware]
                :init             (do
                                    (require 'dirac.agent)
                                    (dirac.agent/boot!))}}
darwin commented 6 years ago

This should work. Can you confirm that the "pause on exceptions" functionality works for your project with standard (internal) devtools as expected? if yes, I will then try to reproduce it in the sample project.

tslocke commented 6 years ago

Working fine with internal devtools + Figwheel yes.

If I open the internal devtools, and enable both "Pause on exceptions" and "Pause on caught exceptions", and run something that raises an error via the Figwheel REPL, execution halts at the error as expected.

If I open the Dirac devtools window (from same browser window - loaded from the Figwheel server), and run the same code in the devtools console, it doesn't halt.

Thanks for your help.

darwin commented 6 years ago

Hmm, commands executed in Dirac console have try-catch wrapper around them for me to present errors in the the (remote) REPL: https://github.com/binaryage/dirac/blob/master/src/runtime/dirac/runtime/repl.cljs#L263.

This might interfere with it. But similar try-catch is implemented in figwheel as well. Not sure how this works exactly. Will investigate.

tslocke commented 6 years ago

Thanks for getting on this so quickly.

Sorry for the noob question - what would be the best way of running Dirac from the latest master? I've tried via the lein-git-deps plugin, but I've had to add a bunch of paths to my :source-paths (e.g. ".lein-git-deps/dirac/src/nrepl") for it to build, which seems kinda messy, and I'm not sure it built correctly because now Dirac is having problems switching namespace.

darwin commented 6 years ago

Better wait for proper release. I will get to it eventually.

A workaround for your REPL interaction in current version is to do the command as async code:

(js/setTimeout #(throw "X") 0)