Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Edit3.Text := floatToStr(StrToFloat(Edit1.Text)/StrTofloat(Edit2.Text))
except
on EZeroDivide do HandleError(0);
on EConvertError do HandleError(2);
on EOverflow do HandleError(3);
on EMathError do HandleError(4);
else
HandleError(999);
end
end;
procedure TForm1.HandleError(ErrorCode : Integer);
var
myLog : TextFile;
errorLine : String;
begin
errorLine := dateToStr(date)+'...';
case ErrorCode of
0: errorLine := errorLine +'Divide by zero ';
2: errorLine := errorLine +'Conver to float ';
3: errorLine := errorLine +'Mathmatical Overflow';
4: errorLine := errorLine +'General Math';
else
errorLine := errorLine +'Unspecified Error';
end;
AssignFile(myLog, 'C:\tempLog.log');
Append(myLog);
writeln(myLog,errorLine);
flush(myLog);
closeFile(myLog);
end;
procedure TMainForm.AppExeption(Sender: TObject; E: Exception);
var FileName: String;
begin
FileName := ExtractFilePath(Application.ExeName) + '\Error.log';
ExeptionsLog.Clear;
if FileExists(FileName) then
ExeptionsLog.Lines.LoadFromFile(filename);
ExeptionsLog.Lines.Add(E.Message);
ExeptionsLog.Lines.SaveToFile(filename);
end;