nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
unwarysage 2018-09-15T01:28:00.000100Z

Hello all again.

unwarysage 2018-09-15T01:28:34.000100Z

I am trying to find a way for a piece of middleware to access a var bound in the current thread

unwarysage 2018-09-15T01:30:05.000100Z

It seems messages inbound to the nREPL have

:session
bound to an atom containing the bindings. But the message on the way out seems to just have the session id bound

unwarysage 2018-09-15T01:30:32.000200Z

This confuses me, as it seems that it should be the other way around

unwarysage 2018-09-15T01:31:24.000100Z

That session id needs to be on the inbound message, and bound variables put on the transport back

unwarysage 2018-09-15T01:31:32.000100Z

does anyone have any insight into this?

2018-09-15T01:44:22.000100Z

it will depend where in the stack your middleware goes

unwarysage 2018-09-15T01:56:56.000100Z

okay.

unwarysage 2018-09-15T01:57:06.000100Z

Hello again @hiredman.

unwarysage 2018-09-15T01:58:06.000100Z

my

set-descriptor!
call only specifies
"eval"
as expected

unwarysage 2018-09-15T01:59:10.000100Z

I wrap the transport of every inbound message to gain access to messages on the way out

unwarysage 2018-09-15T02:00:19.000100Z

this is the raw code

unwarysage 2018-09-15T02:00:45.000100Z

at present only updating the error message with a test string

unwarysage 2018-09-15T02:01:38.000100Z

Ideally I would be assoc-ing in the a value derived from the raw exception. (in line 16) IE, I would love to be able to access

*e

bozhidar 2018-09-15T05:47:43.000100Z

Seems to me you want to do something along the lines of https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/util/error_handling.clj#L172

unwarysage 2018-09-15T06:35:18.000100Z

@bozhidar Ah, I have seen that one before. Please correct me if I am wrong, but is that not dealing with errors thrown by the middleware, not the user code?

bozhidar 2018-09-15T06:47:09.000100Z

Ah, yeah - that’s right. I’m wasn’t quite certain what you’re trying to achieve.

unwarysage 2018-09-15T16:57:13.000100Z

I'm trying to capture error messages thrown from user code, so I can re-write them for simplicity, so that beginning students can use clojure for their first programming language