6 Exceptions

Errors in programs often manifest themselves by threads throwing unhandled exceptions. It would be nice to have a post mortem stack to check how the position of the big bang was reached. Moreover, the environment should be visible.

Ozcar provides this information. Exceptions which would normally be printed in the Emulator buffer are catched by Ozcar, which prints the post mortem stack, together with an explanation of the exception in the status line. All stack frames provide variable information.

In the following example there was forgotten an else branch in the case statement:

local 
   proc {Check X}
      case X
      of foo then {Show 'This is a foo'}
      [] bar then {Show 'This is a bar'}
      end 
   end 
in 
   {Check foobar}
end


Picture 6.1: An unhandled exception has been raised


Emacs prints the location in the source where the error happened. Note that the bar is printed in red, as you reached the position unexpectedly.


Picture 6.2: Emacs shows the position where the error occured


Note that the thread is just about to die; if you do a single step into, it will actually terminate, and the post mortem stack vanishes.


Benjamin Lorenz
Version 1.2.3 (20011204)