edu.vub.at.objects
Interface Handler


 Handler

ATHandler represents a first-class exception handler which have a filter object, describing the kind of exceptions caught by the handler and a code block which acts as replacement code for the code that raised the exception.

Author:
smostinc

Method Summary
 Boolean canHandle(Object exception)
          Returns whether a handler will be triggered when an exception is raised.
 Object handle(Object exception)
          Evaluates the associated handler closure if the handler can handle the given exception.
 
Methods inherited from interface edu.vub.at.objects.Object
super
 

Method Detail

canHandle

Boolean canHandle(Object exception)
Returns whether a handler will be triggered when an exception is raised.

The primary use of this method is to provide a hook to deviate from the default semantics, which is:

def canHandle(anException) { (reflect: anException).isCloneOf(filter); };

Parameters:
exception - an exception.
Returns:
true if the receiver handle will be triggered when the exception is raised.

handle

Object handle(Object exception)
Evaluates the associated handler closure if the handler can handle the given exception.

When a handler has answered that it can handle an exception, the following method is invoked, asking the handler to handle the exception. The default semantics is simply to invoke the associated handler closure.

def handle(anException) { handler(anException) };

Parameters:
exception - an exception to be handled.
Returns:
an Object representing the result of evaluating the associated handler closure.