Recent

Author Topic: How can I suppress exception in Lazarus  (Read 7472 times)

Milsa

  • Sr. Member
  • ****
  • Posts: 328
How can I suppress exception in Lazarus
« on: September 15, 2014, 08:57:57 pm »
I want suppress exception dialogs in Lazarus for exceptions in try except block.

Example:
Code: [Select]
begin
  try
    EXCEPTION //this exception does not shows Lazarus exception window
  except

  end;
end;
Code: [Select]
begin
  EXCEPTION //this exception shows Lazarus exception window
end;
How can I do with Lazarus settings?
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1269
Re: How can I suppress exception in Lazarus
« Reply #1 on: September 15, 2014, 09:41:18 pm »
Don't think you can.

Lazarus - Tools - Options - Debugger - Language Exceptions.

You can choose to ignore selected exceptions, but that choice is global, doesn't depend on whether the exception was raised inside a Try/Except or not.
Lazarus Trunk/FPC latest fixes on Windows 11
  I'm getting old and stale.  Slowly getting used to git, I'll get there...

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Re: How can I suppress exception in Lazarus
« Reply #2 on: September 15, 2014, 10:36:53 pm »
I mean this:

If exception is in try...ecxept block then Lazarus IDE does not notify this exception (now Lazarus notifies all exceptions) because exception is served in program code. I mean debugging in Lazarus IDE, not running EXE file out of the Lazarus IDE.
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1269
Re: How can I suppress exception in Lazarus
« Reply #3 on: September 15, 2014, 10:39:47 pm »
Yes, I understood what you meant, and I repeat - I don't think you can.  You can turn an exception ON or OFF.  Not ON under certain circumstances, but not others.
Lazarus Trunk/FPC latest fixes on Windows 11
  I'm getting old and stale.  Slowly getting used to git, I'll get there...

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: How can I suppress exception in Lazarus
« Reply #4 on: September 15, 2014, 10:59:27 pm »
as mike says the debugger does not know nor care that your code handles the exception or not even if the debugger was able to see that there is an exception handler how would it know that the specific exception is handled or not? It is there for customary when debugging for the debugger to stop on all raised exceptions unless it is instructed to ignore an exception class.

In short no your can't force the debugger to ignore all exception inside the function and capture them outside that function.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Re: How can I suppress exception in Lazarus
« Reply #5 on: September 15, 2014, 11:30:08 pm »
I already understand. Thank you for your help a explanation.
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

 

TinyPortal © 2005-2018