Root > How to... > ...block report sending?

...block report sending?

Previous pageReturn to chapter overviewNext page   

Many times you know that due to user input or other external factors, a line of code will sometimes generate a non-fatal exception in your application. You may not want your mailbox filled with silly bug reports about users entering bad passwords, etc. Using a simple trick you can "hide" these expected exceptions from EurekaLog.



1. If you want to ignore exception completely.


EurekaLog will not trigger if you handle an exception locally with a try/except block. Using such a block means you are expecting an exception in some code and will handle it yourself. You can also choose to silently ignore an exception if it is both expected and non-fatal to your program.


Here are two examples. In the first button click handler we will let EurekaLog handle the exception. In the second click handler, we will completely ignore the exception:


procedure TForm1.btnELHandlesExceptionClick(Sender: TObject);
  // No try/except block, so EurekaLog will catch it
  raise EMyException.Create('Red Alert! Send this bug report to the developer with EurekaLog!');


procedure TForm1.btnLocallyHandledExceptionClick(Sender: TObject);
    raise EMyException.Create('Move along folks; There is nothing to see here.');
    on E: EMyException do
      // Do nothing. EurekaLog will ignore this exception, because we have already handled it with the "on E:..."
      // We could also add code here to take action on the exception with an "on E: EMyException do HandleThisException"
      // We could also re-raise a new exception in our HandleThisException function


See also: How to handle exception?


Note that both exceptions will be caught by your IDE debugger's exception notification handler, but only the first one will generate an EurekaLog bug report. You can configure your IDE debugger to ignore certain exception types.


See also: How to ignore exception? for other possible ways to ignore exceptions.



2. If you want to show exception message, but block sending.


You need to mark exception as expected exception. Marking exception as expected will disable bug report, sending, while keeps showing dialog to the user (error message).


  EEvents; // for RegisterEventExceptionNotify
procedure TForm1.Button1Click(Sender: TObject);
  // EMyException will be handled by EurekaLog.
  // However, it would be considered as expected.
  // "details", "send" and "restart" options will not be shown.
  raise EMyException.Create('Move along folks; There is nothing to see here.');
procedure ExceptionNotify(const ACustom: Pointer; 

  AExceptionInfo: TEurekaExceptionInfo; 

  var AHandle: Boolean; 

  var ACallNextHandler: Boolean);
  // Mark exception as expected, but allow it to be handled by EurekaLog.

  if // this check matches EMyException only, but skips child classes

     AExceptionInfo.ExceptionClass = EMyException.ClassName then 
    AExceptionInfo.ExpectedContext := -1;
  RegisterEventExceptionNotify(nil, ExceptionNotify);



See also:

How to mark exception as expected? for other possible ways to mark exception as expected.

Send feedback... Build date: 2023-09-11
Last edited: 2023-08-09
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: