As I upgrade my applciation to version N+1 there is a number of scripts like
that are run sequentially with TMSScript.Execute.
Up to now I used OnError to handle errors like this
Code: Select all
scrUpgrader: TMSScript; [...] // this is how the OnError eventhandler is setup (one line of code) procedure TfrmUpgrader.scrUpgraderError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction); begin Action := eaFail; end; // this is how i execute the script in a loop (i exclude the loop code): try scrUpgrader.SQL.Clear; scrUpgrader.SQL.LoadFromFile(ScriptName); scrUpgrader.Execute; except On E:Exception do begin Result := False; msg := Format('Error in script %s'+#13#10,[i]); memLog.Lines.Append(msg); end;
Please suggest me how to do.
Should I filter by Exception type or do something in OnError?