[Lazarus] Exception handling in Linux?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Exception handling in Linux?

Free Pascal - Lazarus mailing list
I am working on a port of a Windows Win32 command line program (Delphi
2007) to Linux Ubuntu 18.04 64bit.

I am almost done now and my tests show that the basic functionality
works as intended.
But I am not sure about the exception handling at all...

In my code I have many instances of:
try
  some code block
except
  on E: Exception do
  begin
    LogDebug('Exception in module xxxx: ' + E.Message;
  end
end;

Now when testing I have experienced that Lazarus trows up an exception
dialog when code inside such a construct is running (it typically
comes from some Indy10 operation). When I hit Continue I expect the
code to run the except block but it does not.
There are no log messages concerning the exception....

So I wonder if this is a difference between Windows and Linux or some
missing configuration setting on my part?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Exception handling in Linux?

Free Pascal - Lazarus mailing list
> Now when testing I have experienced that Lazarus trows up an exception
dialog when code inside such a construct is running

The debugger by default catches all exceptions, handled or not, because it
catches the exception before your handler (the except block). Configure
exceptions to ignore in debugger options.

> When I hit Continue I expect the code to run the except block but it does
> not.

There are too many possibilities, if you set a breakpoint in the LogDebug
statement, after pressing continue, does the debugger stop there?



--
Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Exception handling in Linux?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
El 25/10/18 a las 18:46, Bo Berglund via Lazarus escribió:

> I am working on a port of a Windows Win32 command line program (Delphi
> 2007) to Linux Ubuntu 18.04 64bit.
>
> I am almost done now and my tests show that the basic functionality
> works as intended.
> But I am not sure about the exception handling at all...
>
> In my code I have many instances of:
> try
>    some code block
> except
>    on E: Exception do
>    begin
>      LogDebug('Exception in module xxxx: ' + E.Message;
>    end
> end;
>
> Now when testing I have experienced that Lazarus trows up an exception
> dialog when code inside such a construct is running (it typically
> comes from some Indy10 operation). When I hit Continue I expect the
> code to run the except block but it does not.
> There are no log messages concerning the exception....
>
> So I wonder if this is a difference between Windows and Linux or some
> missing configuration setting on my part?
>
>
Do you get that exception dialog when you run the executable out of the
IDE environment?

I mean, maybe the exception is handled inside indy10, so it is not
propagated to the level of your except block. My theory is that the
exception dialog is raised by Lazarus environment whenever an exception
is raised, handled or not, and if you click "continue", then Indy10
handles it.

--
Saludos

Santiago A.

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Exception handling in Linux?

Free Pascal - Lazarus mailing list
On Fri, 26 Oct 2018 12:50:34 +0200, "Santiago A. via Lazarus"
<[hidden email]> wrote:

>Do you get that exception dialog when you run the executable out of the
>IDE environment?
>
>I mean, maybe the exception is handled inside indy10, so it is not
>propagated to the level of your except block. My theory is that the
>exception dialog is raised by Lazarus environment whenever an exception
>is raised, handled or not, and if you click "continue", then Indy10
>handles it.

I think you are probably right. After I checked the box in the dialog
the exception does not show up again...

--
Bo Berglund
Developer in Sweden

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus