[Lazarus] try..except doesn't trap exception in Form.Showmodal
Luca Olivetti
luca at wetron.es
Fri Dec 13 20:22:55 CET 2019
El 13/12/19 a les 17:10, Mattias Gaertner via lazarus ha escrit:
> On Fri, 13 Dec 2019 16:52:36 +0100
> Luca Olivetti via lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
>> El 13/12/19 a les 16:41, Mattias Gaertner via lazarus ha escrit:
>>> On Fri, 13 Dec 2019 16:24:26 +0100
>>> Luca Olivetti via lazarus <lazarus at lists.lazarus-ide.org> wrote:
>>>
>>>> [...]
>>>> But then it has the same problem: even if the form is active, the
>>>> exception could come from somewhere else.
>>>
>>> Do you want the call stack?
>>
>> I know how to get the call stack, it's in the wiki and I use it in
>> some applications to log the unhandled exceptions to a file for later
>> debug, but I don't know if and how I can determine if the exception
>> was generated in a specific form.
>
> As you know, not every exception is raised in a specific form. Maybe you
> can give some example(s), what you want to achieve?
I gave it in my first example:
try
AForm.Showmodal;
except
...
end
And since that isn't supposed to work, I have to trap it with
Application.OnException.
My use case is an unattended application, where every uncaught exception
should abort/restart it, *unless* the exception is generated in an
interactive form (i.e, a user is there, watching it), in that case I can
simply show a message tailored to the form that caused the exception.
Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
More information about the lazarus
mailing list