This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Request for feedback | Implementation strategy for error linkage
* Charles Turner [2011-04-15 16:51] writes:
>> Most of those exceptions carry stacktraces; the stacktrace is filled in
>> at the point where the exception is created. From the stacktrace you
>> can extract: the JVM-level class name, JVM-level method name, source
>> filename and source line number. That should be enough to highlight the
>> source line.
>
> IIUC, that would allow one to highlight where in the Kawa source code
> the error was raised, not where in the input the error occurred. This
> wouldn't allow me to highlight the representative portion of the input
> forms.
Right, the frame for the input form is not necessarily on top of the
stacktrace; it can also be farther below. It will be on the stack
unless the frame was removed by tail-call optimization (which is not
enabled by default).
E.g. you have a stacktrace like:
at gnu.mapping.MethodProc.matchFailAsException(MethodProc.java:105)
at gnu.mapping.Procedure.check1(Procedure.java:333)
at atInteractiveLevel$1.run(stdin:1)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:286)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:187)
at kawa.Shell.run(Shell.java:281)
at kawa.Shell.run(Shell.java:194)
at kawa.Shell.run(Shell.java:175)
at kawa.repl.main(repl.java:852)
you could scan the stack until you find a frame for the REPL input port,
stdin:1 in the example. Alternatively you could make every frame
clickable in some way. E.g. clicking on the first frame could display a
popup window showing part of the file MethodProc.java around line 105
while clicking on the stdin:1 frame would jump directly to the input
position.
Helmut