cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
580 stars 7 forks source link

Error handling response - class java.lang.IllegalArgumentException for stdout in go blocks #2603

Open eneroth opened 2 years ago

eneroth commented 2 years ago

Printing to stdout in go blocks results in an error:

Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

I'm using a socket REPL.

To reproduce:

;; With require [clojure.core.async :as async :refer [go <!]]

;; Timbre
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (timbre/info msg)
        (recur (<! test-ch)))
      (timbre/info "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

(async/close! test-ch)

;; Println
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (println msg)
        (recur (<! test-ch)))
      (println "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil

(async/close! test-ch)

;; Tap
(def test-ch (async/chan))

(go
  (loop [msg (<! test-ch)]
    (if msg
      (do
        (tap> msg)
        (recur (<! test-ch)))
      (tap> "Shutting down loop…"))))

(async/put! test-ch "Hello")
;; Works fine.
(async/close! test-ch)
matthewdowney commented 2 years ago

I ran into the same thing and fwiw I was able to solve it by just using nREPL instead of a normal socket REPL. This slack thread kind of explains what's going on in greater detail.