Fork me on GitHub
#cursive
<
2019-12-06
>
potetm02:12:11

Has anybody else experienced the socket repl swallowing exceptions?

potetm02:12:59

For instance:

(sequence (comp (take 100)
                  (map (fn [i]
                         (when (= i 99)
                           (throw (RuntimeException.))))))
            (range))

potetm02:12:07

just appears to hang

potetm02:12:13

no indication that an exception was thrown

potetm02:12:24

(clojure.repl/pst) shows nothing

alexmiller03:12:40

maybe it wasn't thrown :) sequence is lazy

alexmiller03:12:05

or I should say "incrementally computed" (it's a bit different than lazy sequences)

potetm15:12:35

CLI REPL says:

(sequence (comp (take 10)
                (map (fn [i]
                       (when (= i 9)
                         (throw (RuntimeException.))))))
          (range))
Error printing return value at user/eval8534$fn (NO_SOURCE_FILE:3).
null

potetm12:12:00

repl should be printing it?

potetm12:12:06

i.e. realizing it

Adrian Smith15:12:26

Also looking at another issue where I can't use quick doc on anything either via f1 or triggering the actions bar and selecting quick doc, but if I enable this setting: https://i.imgur.com/raqxHEQ.png quick docs appear on mouse move

potetm15:12:35

CLI REPL says:

(sequence (comp (take 10)
                (map (fn [i]
                       (when (= i 9)
                         (throw (RuntimeException.))))))
          (range))
Error printing return value at user/eval8534$fn (NO_SOURCE_FILE:3).
null

alexmiller15:12:21

well there you go - that's your exception

alexmiller15:12:48

this may be an nrepl thing

potetm15:12:08

Using the socket repl

potetm15:12:25

seems like cursive is either swallowing or socket repl is silent

alexmiller15:12:17

is your connection broken?

alexmiller15:12:47

the provided repl function should catch that during printing, and by default print to stderr, which also by default should get sent over the socket out stream to the client

alexmiller15:12:03

I'm not sure if cursive uses that repl, or what it does on the client side

alexmiller15:12:53

Just using a socket repl outside Cursive, it seems to work:

alexmiller15:12:32

;; terminal 1
clj -J-Dclojure.server.repl="{:port,5555,:accept,clojure.core.server/repl}"

;; terminal 2
$ nc localhost 5555
user=> (sequence (comp (take 10)
                (map (fn [i]
                       (when (= i 9)
                         (throw (RuntimeException.))))))
          (range))
(Error printing return value at user/eval1$fn (NO_SOURCE_FILE:3).
null

alexmiller15:12:45

*e is properly bound and client still works fine after that

alexmiller15:12:31

so, I'm going to put this one on Cursive's socket repl somehow

👍 4
potetm16:12:24

submitting another form evals fine

potetm16:12:40

it’s just radio silence for the form that threw during printing

alexmiller17:12:51

so probably something with stderr tunneling if an error happens during print