Skip to content

Missing nrepl.middleware.caught #6

Closed

Description

@seancorfield

I ran across this trying to get rephrase working on Jolt.

https://github.com/nrepl/nrepl/blob/master/src/clojure/nrepl/middleware/caught.clj

It can't be used as-is, due to its dependency on the Transport type but hopefully it won't be too difficult to add an equivalent middleware for Jolt.

Activity

  1. yogthos commented on Sep 13, 2026

    @yogthos
    Member

    should be addressed here, let me know if that does the trick https://github.com/jolt-lang/nrepl/tree/v0.2.0

  2. seancorfield commented on Sep 14, 2026

    @seancorfield
    Author

    I think it is failing to add ::caught-fn to the message after resolving the :nrepl.middleware.caught/caught key so the wrapped "caught" function does not get that key—so that's a bug.

    If I supply :nrepl.middleware.caught/caught-fn directly, instead of the caught key symbol, then it works:

    (!2023)-> jolt -M:jolt:dev:test:runner
      org.corfield.rephrase.nrepl-test
        adds a wrapper that rephrases exceptions
          √ adds a ::caught/caught key to the message
          √ rephrases a ClassCastException
          √ rephrases an ArityException
      org.corfield.rephrase-test
        prints exceptions to stderr
          √ rephrases a ClassCastException
          √ rephrases an ArityException
          √ does not rephrase an IllegalStateException (but still reorders its stack trace)
    
    Ran 6 test cases in 0.01728 seconds.
    0 failures.
    

    If I supply :nrepl.middleware.caught/caught as a symbol, which is what rephrase does for bb and Clojure, it fails on Jolt because of that missing key.

    See https://github.com/nrepl/nrepl/blob/master/src/clojure/nrepl/middleware/caught.clj#L87-L88 which is missing from your implementation.

  3. yogthos commented on Sep 14, 2026

    @yogthos
    Member

    and hopefully this does it #9

  4. seancorfield commented on Sep 14, 2026

    @seancorfield
    Author

    Confirmed fixed, by testing against the latest SHA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions