Forum > Databases

[resolved]Debugging SQLQuery.EOF loop with a strange SQLQuery.Next code redirect

<< < (2/4) > >>

rvk:
The division by 0 is just an artifact for the benefit of GDB.

What happens if you press continue or run the program outside of the ide (or without debugger)?

It should display the correct exception.

   
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- {------------------------------------------------------------------------------      procedure RaiseGDBException(const Msg: string);          Raises an exception.      Normally gdb does not catch fpc Exception objects, therefore this procedure      raises a standard "division by zero" exception which is catched by gdb.      This allows one to stop a program, without extra gdb configuration.     ------------------------------------------------------------------------------}    procedure RaiseGDBException(const Msg: string);    begin      DebugLn(lrsERRORInCode, Msg);      // creates an exception, that gdb catches:      DebugLn(lrsCreatingGdbCatchableError);      DumpStack;      {$ifndef HASAMIGA} // On Amiga Division by 0 is not catchable, just crash      if (length(Msg) div (length(Msg) div 10000))=0 then ;      {$endif}    end;

indydev:
My Exception "Error loading session: " gets triggered (which makes sense). If I push through that I get a range check error in another unit, but that makes sense since nothing was loaded into the List.

If I run it without debugging, I just get my exceptions and the range check error. The program does not crash. I can keep cycling through these errors, The program performs its other operations without error.

rvk:

--- Quote from: indydev on June 12, 2024, 11:43:50 pm ---My Exception "Error loading session: " gets triggered (which makes sense).

--- End quote ---
I'm after what's behind that message.
The E.Message.
That's telling you the exact exception.

indydev:
Putting everything back and running without debugging the exception gives me the "Error loading session: division by zero" message. However, the content does get displayed briefly behind that message, but then disappears. I get second exception "Error loading session: division by zero" message and then a range check error message, and then the program hangs. So the E.Message is "division by zero".

If I leave the loading part out I just get a couple of "Error loading session: division by zero" messages and then I can use the rest of the program (can't load or save content though).

rvk:
You get the exception part for Error loading session:
So that's the last/outer exception.

So then the exception isn't really the SQLQuery.Next but in the Conversation.Add(QA) part.

What happens if you comment out that line and run without debugger?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version