Jump to content
alogrep

Exception not caught

Recommended Posts

Hi.

It is a few days that the IDE does not catch unhandled exceptions. For example, if i put a line with a division by zero, it just goes on. Before the system caught it and the app stopped after the error message. I have checked for any 'forgotten' Application OnException in my code, but I found none.  The settings in Compile and Linking are shown in the attached picture. What else should I check, please? 

S.jpg

Share this post


Link to post

The debugger catches them before they are handled in the application/project not after.

 

When shown by the debugger there is a checkbox to ignore that class of exception going forward.

Share this post


Link to post

Or maybe floating point exceptions are masked so there is no exception. We can't see your code, or know what version you use. 

Edited by David Heffernan

Share this post


Link to post

Are you using C++ or Delphi? Integer division or floating-point division? Can you provide an example that is not working for you? 

Edited by Remy Lebeau

Share this post


Link to post

Thanks to all.

No, the division by zero was an exampte (and a test I actually didi).

It is all exceptions (that are not handled)

The more critical one is when I set a table to an index name that does not esxist. 

The app just exit, no wrnings.

Share this post


Link to post
43 minutes ago, alogrep said:

Thanks to all.

No, the division by zero was an exampte (and a test I actually didi).

It is all exceptions (that are not handled)

The more critical one is when I set a table to an index name that does not esxist. 

The app just exit, no wrnings.

Doesn't sound like it's not that exceptions aren't handled. App exiting is entirely different. How about the details we asked for. 

Share this post


Link to post

OOps!.

I got confused .

What happens is this

I have this bit of code

 

begin
n:=0;
d:=100/n;
if d>0 then
n:=1;
dm2.tabstable.indexname:='xyz';

The first error is ignored, no warning, no message.

The second error is  caught, but it does notshow the call stack, so I do not know WHERE it happens (in this case yes I know, but is

a nightmare when it may happen God only know where)ERROR.jpg.62301ad34d91b9dad71a2163b32a92c7.jpg 

Share this post


Link to post
2 hours ago, alogrep said:

The first error is ignored, no warning, no message.

That code is performing floating-point division. And as Lejos mentioned, floating-point exceptions behave differently in Delphi 12 than they did in earlier versions.

 

https://dalijap.blogspot.com/2023/09/coming-in-delphi-12-disabled-floating.html


This is also documented by Embarcadero:
 

https://docwiki.embarcadero.com/RADStudio/Athens/en/What's_New#Disabling_Floating-Point_Exceptions_on_All_Platforms

 

Quote

The second error is caught, but it does not show the call stack

If you want to see a Call Stack at runtime, you have to display it yourself. You can catch the Exception (or use the TApplication(Events).OnException event) and then read the Exception.StackTrace property. However, this requires you to install a 3rd party exception logging library, such as MadExcept or EurekaLog, to populate the trace details. Embarcadero does not provide that functionality. In which case, you may as well use that library's own logging capabilities.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×