Search code examples
inno-setuppascalscript

What happens if Abort() is called multiple times in Inno Setup


What will happen if I use Abort() multiple times like:

[Code]

function InitializeSetup(): Boolean;
begin
  Result := True;
  { Some Initialization }
  try
    { some code }
    Abort();
  except
    MsgBox('Abort is called');
    Abort(); { Abort is called Second time. Is this create any problem? }
  end;
end;

Solution

  • The Abort throws an exception, as you obviously know, as you are catching it. See documentation:

    Abort raises a special "silent exception" which operates like any other exception, but does not display an error message to the end user.

    If the exception does not leave the event function, because you catch it using the try...except statement, the Inno Setup never learns about it, so it has no effect on it.

    Only the exception thrown by the latter call to the Abort leaves the event function and has any effect on Inno Setup.