trptcolin / reply

REPL-y: A fitter, happier, more productive REPL for Clojure.
Eclipse Public License 1.0
337 stars 44 forks source link

Standalone REPL: don't exit when printing throws an exception #148

Closed ivan closed 10 years ago

ivan commented 10 years ago

This fixes the standalone REPL to not crash when printing a value that throws an exception during printing, particularly common with lazy sequences:

user=> (take 10 (iterate #(* 2) 10))
ArityException Wrong number of args (1) passed to: user/eval5791/fn--5792
        clojure.core/iterate/fn--4307 (core.clj:2725)
        clojure.lang.LazySeq.sval (LazySeq.java:40)
        clojure.lang.LazySeq.seq (LazySeq.java:49)
        clojure.lang.RT.seq (RT.java:504)
        clojure.core/seq (core.clj:135)
        clojure.core/take/fn--4273 (core.clj:2628)
        clojure.lang.LazySeq.sval (LazySeq.java:40)
        clojure.lang.LazySeq.seq (LazySeq.java:49)
        clojure.lang.RT.seq (RT.java:504)
        clojure.core/seq (core.clj:135)
        clojure.core/map/fn--4248 (core.clj:2553)
        clojure.lang.LazySeq.sval (LazySeq.java:40)
Bye for now!
user=> (lazy-seq #())
IllegalArgumentException Don't know how to create ISeq from: user$eval5781$fn__5782$fn__5783
        clojure.lang.RT.seqFrom (RT.java:525)
        clojure.lang.RT.seq (RT.java:506)
        clojure.lang.LazySeq.seq (LazySeq.java:58)
        clojure.lang.LazySeq.equals (LazySeq.java:115)
        clojure.lang.LazySeq.equiv (LazySeq.java:100)
        clojure.lang.Util.pcequiv (Util.java:125)
        clojure.lang.Util.equiv (Util.java:32)
        clojure.core/not= (core.clj:786)
        reply.eval-modes.standalone/execute (standalone.clj:42)
        clojure.core/apply (core.clj:628)
        clojure.core/partial/fn--4231 (core.clj:2470)
        clojure.core/map/fn--4248 (core.clj:2561)
Bye for now!
trptcolin commented 10 years ago

Yikes, good catch, thanks. Can you make one tweak, to limit the first line of the commit message to 50 characters (w/ any additional in the summary area) as described in http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ? Code looks & works great, much cleaner.

ivan commented 10 years ago

Thanks, fixed.

(Force pushed, watch out.)

trptcolin commented 10 years ago

Great, thank you!