[fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Feb 12 15:01:18 CET 2013


On 02/12/2013 01:58 PM, Mattias Gaertner wrote:
> The LCL has a default exception handler, so that the application 
> notifies the user, that the application has a bug instead of simply 
> crashing and vanishing silently. The programmr is reponsible to handle 
> exceptions, show the user error messages and give the user choices 
> (e.g. ignore, retry).
That's what I was relying on. There's nothing the application can do if 
a user has write-protected the configuration files, or if there's a disk 
error while writing (I didn't think of a non existing .config/, because 
I've always found it there, before the last episode).
So I was just happy with a system error, which in this case fails to show.

As an additional information:
in FormClose

ini := TIniFile.Create(BadAppConfigFileName);
try
   ini.WriteWhatever(...
   ...
except
   on E: Exception do Application.ShowException(E);
end;


shows the error only on the console, but no visual dialog.
While

   on E: Exception do MessageDlg(E.Message,mtError,[mbOk],0);

shows a proper message dialog.

Maybe this discussion should be moved to Lazarus list?

Giuliano




More information about the fpc-pascal mailing list