Root > Reference > Events > TELEvRaiseMeth

Type TELEvRaiseMeth

Previous pageReturn to chapter overviewNext page   

Method event handler for OnRaise event.

 

Unit

EEvents

 

Syntax

 

Code (Delphi)

TELEvRaiseMeth = procedure(

AExceptionInfo: TEurekaExceptionInfo;

var ACallNextHandler: Boolean

) of object;

 

Parameters

AExceptionInfo [in, optional]

Information about exception. Can be nil.

 

ACallNextHandler [out]

True (default) - call next registered event handler, False - do not call next event handler.

 

Remarks

OnRaise event is fired for each raised exception. You can use this event to collect additional information about exception, to change existing information or place any other custom logic.

Important!

Do not place exception processing code into event handler for this event. Use OnExceptionNotify event instead.

 

Note

OnRaise event is invoked when EurekaLog detects that a new exception is raised. Depending on project configuration and environment - it can happen before or after an exception is actually thrown by CPU. This means that not all exception information may be collected. For example, a call stack may be nil - because building call stack for the exception requires CPU context record - which is not available until exception is actually thrown by CPU.

 

Note

OnRaise event is wrapped into OnActionNotify events with atCollectingExceptionInfo/atCollectedExceptionInfo.

 

Caution!

Any event is called from the context of exception thread, which may be not the main thread of application. Thus, it's highly recommended to avoid using any global-like data and to avoid access VCL objects. If you still need to do any of that - please use proper thread synchronization for globals and Synchronize method for VCL access.

 

Warning

Event handlers registered via TEurekaLogEvents component will be active only when corresponding form is live (created). Such handlers will not be called before form is created or after it was destroyed. For this reason you may want to register your event handlers via code. For example, it would be a bad idea to use TEurekaLogEvents component for implementing your error dialog, because your dialog will not be displayed for exceptions outside form (e.g. initialization/finalization exceptions, as well as exceptions in form's constructor).

 

 

Examples

 

Code (Delphi)

raise Exception.Create('Error'); // - event will be raised here

 

See this article for example of registering event handlers.

 

Sample event handler may look like this:

 

Code (Delphi)

procedure TMyObject.OnRaise(AExceptionInfo: TEurekaExceptionInfo; var ACallNextHandler: Boolean);

begin

// Collect additional information for exception

AExceptionInfo.AdditionalInfo := 'Sample additional data';

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_type_eevents_televraisemeth.php