thanks for the patch, this is a significant change so it might take me a while to review it and I can't say whether or not I'll accept it yet.
In the meantime, can you give me a quick overview of the impl approach and a description of which error messages you changed?
Sure, thanks for writing.
Let me start by saying that I'm not married to the approach that I tool with this patch. It seemed to me a good way to make things better, but certainly not the only way.
The tact that I took was:
- Factor out generating the common exceptions and put that code in the errors namespace. I did this because – as I'm sure you are aware – there are four separate implementations of the basic reading code, one each for tools.reader and tools.reader.edn and times two for clojure and clojurescript. There is more or less one
function in errors for each exception.
- In a couple of places I pushed down the specific type of value we are reading into the generic function. So both read-delimited and read-token have an additional 'kind' parameter, so that when something goes wrong they can say "Opps, I was reading a vector (or symbol or keyword) and stuff happened."
- Also added an inspect multimethod whose idea is to provide a safe way to turns values into strings to provide context. I say 'safe' in that inspect will happily turn a keyword or a symbol into a string, but will give you <seq> for lazy (and possibly never ending) sequences.
- I also changed read-string to use an indexing reader.
As for the specifics of the messages, well there are a lot of them. Can I suggest you take a looks at errors.clj - I think the changes are apparent there. If you still need more context then I'll be happy to write up something more formal.