Root > Reference > All Classes > TEurekaExceptionInfo > Properties > TEurekaExceptionInfo.ExceptionObject

Property TEurekaExceptionInfo.ExceptionObject

Previous pageReturn to chapter overviewNext page   

Exception object.

 

Unit

EException

 

Value

Exception object type-casted as pointer. I.e. it's a pointer to data of exception object.

 

Remarks

This is pointer to original exception object.

Warning

Since exception may come from another (external) executable module (rare cases, but could happen), then exception object may be not a Delphi object. Do not try to cast this value to Exception or TObject unless you're 100% sure about this.

 

Use Address, ExceptionClass and ExceptionMessage properties instead.

 

 

Examples

 

Code (Delphi)

// This will add custom info to bug report

procedure AddMyData(const ACustom: Pointer;

 AExceptionInfo: TEurekaExceptionInfo;

 ALogBuilder: TBaseLogBuilder;

 ADataFields: TStrings;

 var ACallNextHandler: Boolean);

 

// Extract native Delphi exception from exception info

function GetExceptionObject(AExceptionInfo: TEurekaExceptionInfo): Exception;

var

EObj: TObject;

begin

// Exception was thrown by a compatible Delphi version?

if (AExceptionInfo.ExceptionObject <> nil) and

 AExceptionInfo.ExceptionNative then

EObj := TObject(AExceptionInfo.ExceptionObject)

else

EObj := nil; // rare

 

// Exception is SysUtils.Exception?

if EObj is Exception then

Result := Exception(EObj)

else

Result := nil; // very rare

end;

 

var

E: Exception;

begin

E := GetExceptionObject(AExceptionInfo);

 // E is either nil (for non-Delphi exceptions or deleted inner exceptions)

 // or E is current Exception

 

// Add custom info for custom exceptions

if E is EMyException then

ADataFields.Values['Code'] := EMyException(E).Code;

end;

 

initialization

RegisterEventCustomDataRequest(nil, AddMyData);

end.

 

See also




Send feedback... Build date: 2024-09-30
Last edited: 2024-09-30
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_property_eexception_teurekaexceptioninfo_exceptionobject.php