Errors that occour in a ClojureScript pREPL connection are :ret as data under :val, not as a string

Description

I'm working on some pREPL based tooling and noticed that if a JVM Clojure pREPL throws an error it is sent to stderr as well as a `:ret` under the `:val` keyword as a string.

When ClojureScript throws an error (in this case within nodejs) there is no stderr output and the `:val` contains actual EDN data, not a string. This inconsistency breaks the assumption that `:val` will always be a string of EDN data.

I've never raised an issue with Clojure before or submitted a patch, I am happy to do so if this is deemed a valid issue and worth fixing.

Environment

Arch Linux x86_64

Activity

Show:
Mike Fikes
December 27, 2018, 5:00 PM

CLJS-2994.patch passes CI

David Nolen
December 28, 2018, 3:30 AM

Oliver, I believe this patch allows more than the Clojure pREPL, yes? i.e. the valf customization bit?

Oliver Caldwell
December 28, 2018, 10:39 AM

Not as far as I know, unless I'm misunderstanding your question. Clojure also allows you to provide valf to io-prepl which defaults to pr-str.

I've tried to align this as closely as I can, the main difference here is that ClojureScript eval already returns results as strings, so identity is okay in most cases. When our prepl returns exceptions however we now pr-str those.

David Nolen
December 28, 2018, 6:43 PM

Thanks, I double checked and can confirm. Looks good to me.

Mike Fikes
December 28, 2018, 6:47 PM
Completed

Assignee

Mike Fikes

Reporter

Oliver Caldwell

Labels

Approval

Accepted

Patch

Code

Affects versions

Priority

Minor