bhauman / rebel-readline

Terminal readline library for Clojure dialects
Eclipse Public License 1.0
680 stars 37 forks source link

Allow customization of exception handling #165

Closed bhb closed 6 years ago

bhb commented 6 years ago

Thanks for the great project!

Apologies if I've missed how to do this, but it'd be nice to be able to provide a callback for handling exceptions so I can customize the output.

For instance, using clojure.main/repl I can provide a :caught handler so I can change the way exceptions print: https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18#file-friendly-clj-L40

It'd be awesome if I could do the same thing with Rebel.

bhauman commented 6 years ago

What you want is to use the api in https://github.com/bhauman/rebel-readline/blob/master/rebel-readline/src/rebel_readline/clojure/main.clj

Particularly rebel-readline.clojure.main/repl which has the same signature as clojure.main/repl

rebel-readline.main/-main just delegates to rebel-readline.clojure.main/-main

bhb commented 6 years ago

Ah, that works great. Thanks for the help! 👍