[Lazarus] try..except doesn't trap exception in Form.Showmodal

Luca Olivetti luca at wetron.es
Fri Dec 13 16:24:26 CET 2019


El 13/12/19 a les 15:51, Michael Van Canneyt via lazarus ha escrit:

>> BTW, is there a way to know where the exception came from? I don't see 
>> any method in Exception to do that, and that's the only parameter that 
>> OnException sees (Sender is nil when I raise an exception inside a form).
>> My use case is, I want to manage only the exceptions generated in a 
>> specific form while I'm modal showing it.
>> I usually set a field telling me that the form is visible and use that 
>> in OnException to guess where it came from, but that will obviously 
>> fail if the form is showing and there's an exception generated 
>> somewhere else.
> 
> Why not use Screen.ActiveForm ?

Never thought of that, d'ho!
But then it has the same problem: even if the form is active, the 
exception could come from somewhere else.

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