[aosd-discuss] Antw.: Support for error handling by aspect-oriented programming

Bram Adams bram.adams at ugent.be
Sun Apr 22 06:05:50 EDT 2007


Hi,

Op 21-apr-07, om 10:58 heeft Markus Elfring het volgende geschreven:

> Are you going to provide a corresponding library of predicate  
> functions "is_error..." to check for error codes with your pointcuts?
> Condition examples:
> 1. != OK
> 2. != 0
> 3. == -1
> 4. < 1
> 5. ferror(file)
> 6. GetLastError()

Yes, as extracting these checks from the advice body into the  
pointcut would make the advice more reusable and allow more efficient  
woven code. Aspicere2 does currently not provide this kind of dynamic  
conditions in a pointcut, but this is only a matter of time.  
Actually, we have a thesis proposal open for this :-) (see http:// 
faramir.ugent.be/thesis/200702.html, in Dutch).

However, it is important to stress that we intended our aspects for  
the ASML case to be written once by experts WITHOUT letting base code  
developers touch or write any aspects. Instead, they should configure  
them through the use of annotations whenever the standard, documented  
aspect behaviour needs to be overridden or enhanced. This makes the  
aspect-base code interaction more manageable, while the annotations  
make the developers' intentions explicit.

E.g., by default error values are propagated up unmodified until they  
are catched somewhere (or the system crashes). Often, the developers  
also want to obtain a kind of exception trace by linking a  
semantically richer error value to the current one, logging it and  
propagating up the new value. To do this, base code developers just  
need to annotate the relevant procedure calls with the right higher- 
level error value:

/*@log("LINKED_ERROR")*/
g(5);

Specialised error handlers are still written in the base language  
(NOT in an aspect), as in our example system there are only a few  
places where other things than e.g. logging or memory cleanup is  
needed. So, the checks for error codes you mentioned are only useful  
in the few general system-wide aspects written by the experts (error  
propagation, logging, memory cleanup, ...), and would not be used to  
encapsulate specialised error handlers in advice.

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)



More information about the discuss mailing list