...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
-------------------------------------------------------------------------------- -- Declare in beginning of every function to ensure that all EDM errors are -- caught and that exceptions propagate upwordsupwards in the stack. -- On_Error_Do xpxThrow(GetException(?)); End_On_Error_Do; -- Throw "soft" errors from code like this: -- xpxThrow(GetException('Something when wrong')); -- To ignore an exception and reset exception chain: -- On_Error_Do cancelException; End_On_Error_Do; Function GetException(Message : String) : Aggregate Of Exception; Local lInnerException : Exception; End_Local; If NVL(xpxExceptionId.errCode, 0) <> 0 Then -- EDM error lInnerException := GException; New GException; GException._Type_ := 'edmException'; GException.errCode := xpxExceptionId.errCode; GException.errMessage := xpfGetErrorText(xpxExceptionId.errCode); GException.functionName := xpxExceptionId.functionName; GException.lineNumber := xpxExceptionId.lineNumber; GException.innerException := lInnerException; xpxPrintf('Line #%d: Exception. EDM Error number: %d, Message: %s', xpxCurrentLine, GException.errCode, GException.errMessage); GExceptions ++ GException; End_If; If NVL(Message, '') <> '' Then lInnerException := GException; New GException; GException._Type_ := 'xpxException'; GException.userMessage := Message; GException.innerException := lInnerException; xpxPrintf('Line #%d: Exception: Message: %s', xpxCurrentLine, GException.userMessage); GExceptions ++ GException; End_If; Return(GExceptions); End_Function; -- To ignore an exception from lower level and continue -- execution as normal call the following function. Procedure CancelException; GExceptions := []; GException := ?; End_Procedure; --------------------------------------------------------------------------------------------- |
...