Raise Exception in thread
Posted: Thu Oct 24, 2019 7:09 pm
Hello!
In my project there are many objects of class TThread. Each of them has own log, that can be viewed in mainform.
Some of threads crash and madExcept processed exception, How i can also write exception message to log after MadExcept catch?
In my project there are many objects of class TThread. Each of them has own log, that can be viewed in mainform.
Some of threads crash and madExcept processed exception, How i can also write exception message to log after MadExcept catch?
Code: Select all
procedure TMainForm.ThrOnTerm(Sender: TObject);
var
i: word;
E: Exception;
begin
i:=TBotThread(Sender).num;
if not TBotThread(Sender).DeleteBotData then begin
E:=(Bot[i].thr.FatalException as Exception);
if E<>nil then
Bot[i].thr.log('Ошибка: '+E.ClassName+' '+E.Message,2); ----- i write log here, but nothing catch
Bot[i].BD.data.Status:='Выключен';
Bot[i].thr:=nil;
end;
end;
thr.OnTerminate:=ThrOnTerm;