Root > Reference > Events > TELEvExceptionActionMeth

Type TELEvExceptionActionMeth

Previous pageReturn to chapter overviewNext page   

Method event handler for OnExceptionAction event.

 

Unit

EEvents

 

Syntax

 

Code (Delphi)

TELEvExceptionActionMeth = procedure(

AExceptionInfo: TEurekaExceptionInfo;

const AEurekaAction: TEurekaActionType;

const AAdditionalInfo: String;

var AExecute: Boolean;

var ACallNextHandler: Boolean

) of object;

 

Parameters

AExceptionInfo [in, optional]

Information about exception. Can be nil.

 

AEurekaAction [in]

Action to perform.

 

AAdditionalInfo [in, optional]

Additional information about action (see remarks).

 

AExecute [out]

"Before-like" actions: True - (default) perform action, False - cancel/skip action;

 

"After-like" actions: True - action is successful, False - action was unsuccessful;

 

Note

This argument is ignored for atSendCancelled.

 

 

ACallNextHandler [out]

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

Tip

Set to False, if you set AExecute to False.

 

 

Remarks

OnExceptionAction event is fired for any action with exception during exception processing: saving to bug report, sending via Internet, etc. You can use this event to alter actions, cancel/skip them, etc.

 

AAdditionalInfo argument holds additional information for actions. Currently this argument have non-empty value for atSending and atSent actions. For these actions - AAdditionalInfo argument holds send engine class name. This information is useful if you use several send methods (for example, HTTP and e-mail). See also.

 

For "before"-like actions: AExecute will determinate if EurekaLog should execute the action. You can use this to skip certain actions (e.g. skip sending, skip dialog, skip saving bug report, etc.).

 

For "after"-like actions: AExecute will determinate if EurekaLog should consider action as succeeded (or failed). You can use this to skip errors.

 

Note

Basically, for most actions EurekaLog follow such pattern (pseudo-code):

 

Code (Delphi)

repeat

 MakeCall := DoEventExceptionAction(... "before" ...);

 try

 if MakeCall then

 Result := PerformAction

 else

 Result := Cancelled;

 except

 Result := UnknownError;

 end;

 Result := DoEventExceptionAction(... "after" ...);

 

 if Failed(Result) then

 Retry := DoEventExceptionError(...)

 else

 Retry := False;

until not Retry;

 

 

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)

try

raise Exception.Create('Error'); // - OnRaise event handler will be called

except

Application.HandleException();

 // - OnExceptionNotify will be called

// - set of OnExceptionAction events will be called

 // (one event for each action (saving, sending, etc).)

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