7 Unhandled Exceptions

Errors in programs often manifest themselves by unhandled exceptions. Ozcar supports post-mortem inspection of threads that died of a system or error exception. (User exceptions do not provide debugging information - work around this by raising your exceptions as error exceptions, using Exception.raiseError.)

Exception Handling

Any unhandled exception, which is normally just printed out to standard error, is caught by Ozcar. It attaches the dying thread and displays the stack from the time the exception was raised (or re-raised). The topmost frame gets the description exception followed by the exception value itself. Note that all stack frames include environment information. The description of the exception itself is provided in the Status Line.

Example

Consider the following code. Its author forgot to handle some value in his patterns, leading to a missing else exception, as depicted in Picture 7.1:

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 7.1: An Exception has not been Handled


Source View

Emacs displays the location in the source code where the exception was raised. Note that the bar is colored red, as the position has been reached unexpectedly.


Picture 7.2: Emacs Showing the Error Position



Benjamin Lorenz and Leif Kornstaedt
Version 1.4.0 (20080702)