EditorMAcroScript: Add some more try except dealing with self-test. Save reason of failure

git-svn-id: trunk@43398 -
This commit is contained in:
martin 2013-11-08 23:52:29 +00:00
parent 6767c20339
commit 6770c13d81
2 changed files with 21 additions and 1 deletions

View File

@ -78,6 +78,7 @@ type
TEMSConfig = class(TAbstractIDEEnvironmentOptions)
private
FSelfTestActive: Boolean;
FSelfTestError: String;
FSelfTestFailed: Integer; // stores EMSVersion that failed
protected
function GetXmlConf: TRttiXMLConfig;
@ -92,6 +93,7 @@ type
published
property SelfTestActive: Boolean read FSelfTestActive write FSelfTestActive;
property SelfTestFailed: Integer read FSelfTestFailed write FSelfTestFailed;
property SelfTestError: String read FSelfTestError write FSelfTestError;
end;
function GetEMSConf: TEMSConfig;

View File

@ -25,10 +25,26 @@ begin
if not EMSSupported then exit;
conf := GetEMSConf;
conf.Load;
try
conf.Load;
except
try
conf.SelfTestFailed := EMSVersion;
conf.SelfTestActive := False;
conf.SelfTestError := 'load error';
conf.Save;
except
end;
MessageDlg(EmsSelfTestErrCaption,
format(EmsSelfTestFailedLastTime, [LineEnding]),
mtError, [mbOK], 0);
exit;
end;
if conf.SelfTestActive then begin
conf.SelfTestFailed := EMSVersion;
conf.SelfTestActive := False;
conf.SelfTestError := 'failed last time';
conf.Save;
MessageDlg(EmsSelfTestErrCaption,
format(EmsSelfTestFailedLastTime, [LineEnding]),
@ -50,6 +66,7 @@ begin
if not ok then begin
conf.SelfTestFailed := EMSVersion;
conf.SelfTestActive := False;
conf.SelfTestError := SelfTestErrorMsg;
conf.Save;
MessageDlg(EmsSelfTestErrCaption,
format(EmsSelfTestFailed, [LineEnding, SelfTestErrorMsg]),
@ -58,6 +75,7 @@ begin
end;
conf.SelfTestActive := False;
conf.SelfTestError := '';
conf.Save;
EditorMacroPlayerClass := TEMSEditorMacro;