New Delphi and C++ Builder IDEs offer extented RTTI with support of custom attributes. EurekaLog is able to use custom attributes to alter behaviour for exception types. This is similar to exception filters. Using exception filters is simple, but sometimes it's not very convenient. So, instead you can define EurekaLog behaviour right when you declare exception classes (this code will be ignored if there is no EurekaLog installed).
Custom attributes are declared in EClasses unit. The following attributes are declared:
EurekaLogHandler = class(TCustomAttribute)
constructor Create(Value: TFilterHandlerType);
property Handler: TFilterHandlerType read FHandler;
EurekaLogMessage = class(TCustomAttribute)
constructor Create(Value: String);
property Message: String read FMessage;
EurekaLogAction = class(TCustomAttribute)
constructor Create(Value: TFilterActionType);
property Action: TFilterActionType read FAction;
EurekaLogDialog = class(TCustomAttribute)
constructor Create(Value: TExceptionDialogType);
property Dialog: TExceptionDialogType read FDialog;
EurekaLogExpected = class(TCustomAttribute)
constructor Create(const AContextNumber: Integer = -1;
const AURL: String = ''; const ABugID: TBugID = 0);
property URL: String read FURL;
property Context: Integer read FContext;
property BugID: TBugID read FBugID;
Here is a sample on how to use them:
// ETestException will be ignored by EurekaLog and
// it always will be handled by your application
// (as if EurekaLog would be disabled)
ETestException = class(Exception);
// Exception message will be replaced
[EurekaLogMessage('Sorry, there was an error.')]
ECustomMessage = class(Exception);
// Switch dialog to EurekaLog-Detailed style
EDialogException = class(Exception);
// Mark exception as expected
EMyException1 = class(Exception);
// Mark exception as expected, assign help topic ID = 1234,
// show "Help" button in dialogs
EMyException2 = class(Exception);
// Mark exception as expected, assign online help topic (URL),
// show "Help" button in dialogs
EMyException3 = class(Exception);
// Mark exception as expected, assign a fixed BugID
[EurekaLogExpected(-1, '', $C4F10001)]
EMyException4 = class(Exception);
You get the idea - when you declare exception type, you can add attributes to it. Each attribute will modify EurekaLog behavior for exceptions of this class only. This works the same as exception filters (actually, internally custom attributes just creates new filter rule).
To learn more about custom attributes - visit RAD Studio help.
Important note: ensure that features specified by your code will be available at run-time. For example, if your application uses MS Classic-styled exception dialog by default and you want to switch to EurekaLog-styled dialog with your code - then be sure to include code for EurekaLog dialog into your application. The same is true for send engines. Hooks and debug information providers are registered on startup and could not be customized at run-time.
Build date: 2019-08-09
Last edited: 2018-06-14
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/customizing_custom_attributes.php