Root > Integral parts > Options > Advanced page > Exceptions filters page > Editing exception filter

Editing exception filter

Previous pageReturn to chapter overviewNext page   

This is exception filter dialog which is used to add or edit exception filters.

 

Dialog consists of two pages:

 

 

Exception Identification Page

 

Exception Identification Page contains filter options which are used to find matched exception. When exception occurs:

1. EurekaLog walks through all available exception filters.
2. Each filter is compared against current exception.
3. If current exception matches "identification" properties of exception filter - search is over and filter is applied to exception.

 

Available options are:

 

1. "Exception Class" option specifies exception class name. This is mandatory option. Filter will be applied only for exceptions of the specified class. You can pick predefined classes from combo-box (such as EAbort or EAccessViolation) or enter your own classes (such as EMyException). If you want to catch all exceptions - specify "Exception" class.

 

Important note: your exception classes must be real classes. You can not use aliases. For example:

 

type
  EMyException1 = class(Exception);
  EMyException2 = Exception;

 

You can specify 'EMyException1' as exception class name. However, 'EMyException2' will not work. Because there is no such class. You should use 'Exception' instead.

 

Important note: you can not use exception filters to alter behavior for leaks (e.g. EMemoryLeak/EResourceLeak), because exception filters are already finalized when leaks checking is running.

 

 

2. "Exception Kind" option specifies whenever this filter will be applicable to unhandled exceptions, handled exceptions, SafeCall exceptions or all of them. This is mandatory option.

 

SafeCall exceptions are considered to be handled exceptions. "Handled" value will catch any kind of handled exception - regardless of it being SafeCall exception. "SafeCall" value will catch only SafeCall exceptions, but no other handled exceptions.

 

Tip: Filter is applicable for all exceptions by default. Different processing for handled and unhandled exceptions may be confusing, so it's recommended to avoid it when possible.

 

Note: this option is ignored if your application do not process handled or SafeCall exceptions.

 

 

3. "Exception Module Name" option specifies name of file for executable module. Such as 'Project1.exe' or 'BugDLL.dll'. This option is optional. Filter will be applied only to exceptions raised from the specified module.

 

Notes:

You must specify file name only without any file path.
Module name comparison follows case sensitivity of host OS.
This option uses ExceptionAddress property to determinate module name.
This option does not require debug information to work.

 

 

4. "Exception Unit Name" option specifies unit name. Such as 'SysUtils', 'Unit1', 'Project1', etc. This option is optional. Filter will be applied only to exceptions raised from the specified unit.

 

Notes:

This option uses ExceptionAddress property to determinate unit name.
This option requires debug information to work.

 

 

5. "Source Class Name" option specifies class name. Such as 'TFileStream', 'TForm1', etc. This option is optional. Filter will be applied only to exception raised by methods of the specified class.

 

Notes:

This option uses ExceptionAddress property to determinate class name.
This option requires debug information to work.

 

 

6. "Procedure/Method Name" option specifies function or method name. Such as 'Create', 'Destroy', 'Read', 'Button1Click', etc. This option is optional. Filter will be applied only to exceptions raised by specified method or function.

 

Notes:

This option uses ExceptionAddress property to determinate function/procedure/method name.
This option requires debug information to work.

 

 

7. "Exception Properties" option specifies set of properties to match. This option is optional. Filter will be applied to exceptions which have specified properties with exact the same values.

 

Properties should be entered as: one property on single line.
Each line must have "name=value" form (as indicated on the screenshot above).
String values must be enclosed in double quotes.
Use \q to insert double-quote inside string value.
Enumerated types must be entered as integers.

 

Important note: this option can only work with Delphi/C++ Builder exceptions with RTTI info available! Standard exception classes usually do not have RTTI information.

 

 

 

Altering Behavior Page

 

Altering Behavior Page contains filter options which alters exceptions. These options are applied to exception altering its properties and/or behavior. Options are applied only for matched filter.

 

Note: at least one of the options on this tab must be changed. Otherwise filter will do nothing.

 

Available options are:

 

1. "Set Handler to" option allow you to define who should handle exception:

"None" handler will ignore exception. I.e. exception will not be handled at all. This handler will not allow you to edit any additional options. This case is used for such exceptions as EAbort.
"RTL" handler will pass exception to default processing. This is the same as if EurekaLog would be disabled. This handler will not allow you to edit any additional options. This case is used for "expected" exceptions, which do not require bug report creation.
"EurekaLog" handler will pass exception to EurekaLog. This is default in EurekaLog-enabled application. This handler also allow you to specify additional options (see below). This is default and recommended case for most exception classes.

 

 

2. "Override Exception Message" option allow you to override exception message. Leave this field empty to use original exception message. You can use this option to supply user-friendly error message (such as "Sorry, there was an error. Please, restart application") instead of low-level error message (such as "Access violation in module Project1.exe at address 123456"). This option affects only visual dialogs. Bug report will contain original exception message. See also "Exception Message" option.

 

Note: you can use environment variables in this field, so you can also insert original exception message as part of your customized message (for example: "Sorry, there was an error. Please, restart application. Low-level error message: %_ExceptMsg%").

 

 

3. "Change Dialog to" option allow to change default dialog (as set in EurekaLog project options) to any available dialog class.

 

 

4. "Action after exception" option allow you to perform restart action after processing exception. This is useful for exceptions like access violation. You may want to terminate/restart your application after such exceptions to avoid induced exceptions.

 

 

5. "Expected Exception Context ID" option allow you to assign Context ID to exception. This is integer value which is expected to be ID of help topic describing exception.

 

Notes:

Setting this option to any positive value (or -1) will convert exception to "expected" exception. Expected exception display error dialogs, but does not generate bug reports. 0 (default) will not mark exception as "expected".
Set this property to a valid ID of help topic. If you do not have help topic for exception, but want to mark exception as "expected" - then set this option to -1.
Use either "Expected Exception Context ID" option or "Expected Exception URL" option, but not both.
Expected exception with valid Context ID (positive) or valid URL will cause "Help" button to be shown in error dialogs.

 

 

6. "Expected Exception URL" option allow you to assign URL for the exception. This URL is expected to point to online help or Knowledge Base topic/article describing exception.

 

Notes:

Setting this option to any non-empty value will convert exception to "expected" exception. Expected exception display error dialogs, but does not generate bug reports.
Set this property to a valid URL of online help topic. If you do not have help topic for exception, but want to mark exception as "expected" - then use "Expected Exception Context ID" option and set it to -1, keep "Expected Exception URL" option empty.
Use either "Expected Exception Context ID" option or "Expected Exception URL" option, but not both.
Expected exception with valid Context ID (positive) or valid URL will cause "Help" button to be shown in error dialogs.

 

 

7. "Exception BugID" option allow you to specify fixed BugID for this exception. If this value is 0 - BugID will be generated automatically. If this value is not 0 - automatic generation will be disabled. Specified BugID will be used.

 

Note: you can use both decimal (1234567890) and hexadecimal ($C7D40000) forms.

 

Warning: be extra careful when assigning this value. Your value may overlap with automatically generated BugIDs. Best strategy is to utilize user part of BugID (low word). See BugID for more info.

 

 

See also:




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