Root > Reference > All Classes > TExceptionManager > Methods > TExceptionManager.Handle

Method TExceptionManager.Handle

Previous pageReturn to chapter overviewNext page   

Handles (processes) specified exception.

 

Unit

EExceptionManager

 

Syntax

 

Code (Delphi)

public

function Handle(

const AInfo: TEurekaExceptionInfo;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

function Handle(

const AInfo: TExceptionData;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

function Handle(

const AInfo: Pointer;

const AAddr: Pointer = nil;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

function Handle(

const AInfo: TObject;

const AAddr: Pointer = nil;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

function Handle(

const AInfo: Windows.TExceptionRecord;

const AContext: PContext = nil;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

function Handle(

const AInfo: TExceptionPointers;

const AHandled: Boolean = False;

const ARespectActivation: Boolean = True

): TResponse; overload;

 

Parameters

AInfo [in]

Exception object, exception information, exception data, or any other information which identifies exception (there are multiple overloads variants of the same Info method). If this value is not specified ( nil) - then method will return srNoExceptionInfo.

 

AAddr [in, optional]

Exception address. Typically this is ExceptAddr value. This argument is present not in all overloaded methods.

 

AContext [in, optional]

Pointer to low-level CPU information. This information will be used for creation of new information. It's not used for identification purposes.

 

AHandled [in, optional]

True - this exception is handled. False - this exception is unhandled.

 

Exception information will be modified with this value. Handled/Unhandled sign is used for two different kinds of exception processing. "Handled" exceptions are not processed by default.

 

ARespectActivation [in, optional]

True (default) - check the current status of EurekaLog. If no EurekaLog is enabled - return srRestart, otherwise (EurekaLog is enabled) - do the usual work.

 

False - always process the exceptions even if EurekaLog is not active.

 

Return value

Result of exception processing. This record hold multiple fields with information - code, messages, etc. See TResponse for more information.

 

Remarks

This method performs processing of exception - that is: dialog, bug report saving, sending.

 

This function is a wrapper for ProcessException function, except it also updates exception manager state:

1. This method invokes OnExceptionNotify event.
2. Exception filters are launched (if present).
3. Statistics for auto-restart feature is calculated.
4. ProcessException function is called to perform actual processing.
5. This method is also handles all exceptions during processing, converting them to TResponse value.

 

Important!

It's recommended to use Handle method of exception manager instead of calling ProcessException directly.

 

Important!

Handle method will process only already raised exceptions (i.e. with actual call stack). Handle method will return srNoExceptionInfo for non-raised exceptions. For example:

Code (Delphi)

E := Exception.Create('My custom exception');

ExceptionManager.Handle(E); // - will do nothing, return srNoExceptionInfo

 

 

Code (Delphi)

CallStack := EurekaCallStackClass.Create(EurekaCallStackClass.Caller);

try

 EI.CallStack := CallStack;

finally

 FreeAndNil(CallStack);

end;

ExceptionManager.Handle(E); // - will do the usual processing (bug report, dialog, sending, etc.)

 

 

Examples

 

Code (Delphi)

try

// ... your code ...

except

ExceptionManager.Handle(ExceptObject, ExceptAddr);

end;

 

Code (Delphi)

Thread := TMyThread.Create(False);

try

Thread.WaitFor;

ExceptionManager.Handle(Thread.FatalException);

finally

FreeAndNil(Thread);

end;

 

See also

ProcessException Function



Send feedback... Build date: 2018-11-26
Last edited: 2018-11-26
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_method_eexceptionmanager_texceptionmanager_handle.php