Exception info is represented by TEurekaExceptionInfo class from EException unit.
Important: EurekaLog has to be enabled for this to work. See also.
Option 1Assuming you are inside EurekaLog's event handler - this information is passed as argument:
uses AExceptionInfo: TEurekaExceptionInfo; // <- here var AHandle: Boolean; var ACallNextHandler: Boolean); // ...
Option 2Assuming you have access to RTL's exception object:
uses // EI could be nil if EurekaLog is disabled or // if exception is ignored by EurekaLog if Assigned(EI) then // ...
Note: due to bugs in some older IDEs, you may need to write like this: EI := ExceptionManager.Info(Pointer(E));
Option 3Assuming you want exception info for last (most recent) exception in current thread:
uses
Checking exception's infoOnce you have obtained a TEurekaExceptionInfo instance - you can read various properties. Below is an example of different checks that you can use.
if // check exception class name // check exception message // check that there is an exception object (AExceptionInfo.ExceptionObject <> nil) and // check that it is a Delphi/Builder object // check exception class // (only for .ExceptionNative = True and .ExceptionObject <> nil) // IMPORTANT NOTE: Please note that the .ExceptionObject may be unavailable even for Delphi exceptions! // For example, if the exception object was already deleted: // // try // raise Exception.Create('Inner Exception'); // - will be deleted // except // on E: Exception do // raise Exception.Create('Outer Exception'); // end; // // See also. // That is why we check for NIL in the example above. // For this reason we highly recommend to use properties of AExceptionInfo when possible, // Such as .ExceptionClass and .ExceptionMessage
// check any additional exception properties // check call stack // check exception address // check exception module (AExceptionInfo.Module = HInstance) and // check exception module name // check exception thread // check for known BugID // check for handler (what hook has catched the exception) // check for misc. props
The code above is only an example, you don't need to write it all.
See also:
|