This has been quite a bit of time in the making but I’ve finally got an open-source project I’ve been working on to a demoable stage, so I humbly present to you the Clojure Error Mediator.
So what is this thing?
Clem is a tool that integrates with users’ REPLs and helps provide more understandable error messages for new users. Probably most of you know that Clojure’s error messages are…unhelpful at times (how many beginners know that forgetting a quote on a list causes a ClassCastException?). This tool aims to bridge that gap for new users so that they can more quickly an easily get a foothold on the language.
This is accomplished using a REPL plugin/wrapper which reaches out to Clem’s server to get information on the exception, if it exists. This information is automatically printed in the user’s REPL, or if Clem doesn’t have a helpful message for that error, it prints Clojure’s normal message.
How does it work
Clem overrides the exception-caught function of a repl and gathers some information about the exception which it sends to its server. Based on the stack-trace, message, type, and phase of the exception, Clem matches it to existing exceptions and returns a message which it then displays to the user. Everything is written in Clojure(Script) including the website!
As mentioned above, this project is essentially in a demo state, mainly because there simply aren’t a lot of errors stored on the project at the moment. It needs users to both use the repl interface in order to “prime” the server and also to add helpful messages to the server (and help finding elusive bugs would also be appreciated). I’d love to have the community test out the project by installing the repl integration and add messages to the website. Of course, this is an open source project, so code contributions are always welcome.
Why not use X project instead?
Obviously, Clem is not the only solution to this problem, nor even the only good solution. But we haven’t found another project that targets new users and requires a minimum of installation for the new users. I’ve seen some progress on getting better messages in clojure.core, but that’s a bit of a slow process and we figured we may as well work on something to help in the meantime (and there may be a place for less formal language in something like Clem).
But also, Clem has been in the works for about 2 years now, so X may not have existed when we started. We’re definitely hoping to serve the community and want to collaborate in whatever way is most helpful!