Is there a way to check that madExcept.SendBugReport has actually finished sending please? When necessary, I am creating an exception in the FormCloseQuery event handler of the main form, and passing it to the function below.
But if I let the app close naturally then it's very unlikely I'll get the bugreport, & if I do then I get the bugreport email but without the bugreport.txt attachment.
If I set CanClose = false or put in a MessageDlg, or indeed anything that gives madExcept time to work then I reliably get the bug reports.
However, none of the above is particularly elegant - so is there anyway for me to check whether sending has completed before allowing the app to close.
I don't want to show any pop up message boxes to the user, but I am quite happy for them to see progress bars etc whilst the bug report is creating & sending.
Thanks,
Stuart
Code: Select all
function madExceptSilentSendException(E: Exception) : boolean;
var
exc: IMEException;
assis: INVAssistant;
strBugReport : string;
begin
exc := madExcept.NewException(etNormal, E);
// Adding some app specific settings
Exc.BugReportHeader['From_User'] := CurrentUser.UserName;
Exc.BugReportHeader['From_Name'] := CurrentUser.Fullname;
Exc.BugReportHeader['From_Email'] := CurrentUser.Email_Address;
Exc.BugReportHeader['DB_CONN'] := RemoteConnectionType; // e.g. MSSQL, MySQL, SQLite
Exc.BugReportHeader['DB_URL'] := ClientChannel.TargetURL; // e.g. http://localhost:8099/bin
// ReplicatorLog is TStringList
if (e is EReplicationFailed) then
if assigned(ReplicatorLog) then
Exc.BugReportHeader['REPLICATOR_LOG'] := ReplicatorLog.Text;
strBugReport := Exc.GetBugReport(True); // wait for complete bug report
exc.MailAddr := CurrentUser.email_address;
exc.MailFrom := CurrentUser.fullname + '<' + CurrentUser.email_address + '> ';
result := madExcept.SendBugReport(exc.BugReport, nil, 0, Exc) = madTypes.yes;
if not result then
madExcept.AutoSaveBugReport(exc.BugReport, Exc);
end;