After feedback on my previous compiler error message patch,
I've started looking into the problem more. My goal is to have the
file and line number printed on every user-visible stack trace.

An example of my desired output is:

java.lang.IllegalArgumentException: /Users/arohner/Programming/clojure/
broken-arity.clj Line 6: Wrong number of args passed to foo
        at clojure.lang.AFn.throwArity(AFn.java:461)
        at clojure.lang.AFn.invoke(AFn.java:68)
        at user.eval__2291.invoke(broken-arity.clj:6)
        at clojure.lang.Compiler.eval(Compiler.java:3891)
        at clojure.lang.Compiler.load(Compiler.java:4192)
        at clojure.lang.Compiler.loadFile(Compiler.java:4159)
        at clojure.lang.Repl.main(Repl.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at jline.ConsoleRunner.main(ConsoleRunner.java:69)

Right now, there are 308 places where new exceptions are thrown in the
clojure source. Rather than modify the message of each exception, I am
thinking that it would be a good idea to make a hierarchy of clojure
exceptions, like Clojure.SyntaxError, Clojure.RuntimeError,
etc. The Clojure exception's getMessage() would be extended to contain
Compiler.SOURCE_PATH and Compiler.LINE_AFTER.

Then, replace all of the exceptions in the source that use 'standard'
java exceptions like java.lang.ArrayIndexOutOfBounds and
java.lang.IllegalArgument with one of the exceptions from the Clojure
hierarchy.

Thoughts?

Allen

p.s. last night I was writing Clojure code that exercises the
different kinds of Compiler errors that can be thrown. It wouldn't
take too much effor to turn those into a test suite. Rich, is this
something you would be interested in having?

p.p.s My CA is in the mail



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to