Hi,
I'm currently working on my first automation script. I don't use the ExitSuccess method at the end of my script and everything works fine. (The script stops as expected, there is a log line)
That raised the question: is ExitSuccess actually needed and if so why?
(I understand that when working with interactive automation scripts, it is useful to be able to exit the script and indicate this is expected behavior)
Thanks in advance!
Hi there,
Please have a look at following related post: How is engine.ExitSuccess("reason") handled? - DataMiner Dojo
In a normal flow, You are not expected to call the ExitSuccess() method.
I believe the intend is only to use it if you have a certain scenario deeper down your code that you whish to finish early and escape.
Note that as the linked questions/answer suggests: When using this call, you also have to manage the processing of the Abort-Exception that is thrown.
Hope this helped!

To complement this, and since you also mentioned Interactive Automation Scripts, it’s worth noting that when you want to close the user interface intentionally, you should typically throw a CloseUserInteractionException instead of using ExitSuccess, which internally throws an AbortException.
This allows the UI to close gracefully and indicates that the closure is expected behavior.
A common pattern for handling this is:
try
{
// Your logic here
}
catch (CloseUserInteractionException)
{
// Expected behavior — the user closed the UI
}
catch (Exception ex)
{
// Handle other unexpected exceptions
}
Thanks!