Hi Dojo,
I have a script that shows an error message when something goes wrong by using engine.ExitFail() method.
This is also visible in the automation logging.
2024/01/18 10:04:11.452|SLAutomation.exe 10.4.2347.224|20848|16900|Script|INF|-1|[Jens Vandewalle] (Script Cost and Billing - Script - Calculate Cost) Log Message: "System.Exception: Ratecard not found for resource Teleste IP receiver module 1 at Script.FetchResourceRatecard(NodeDetails node) at Script.LoadRatecardsForAllNodes(IEnumerable`1 nodes) at Script.RunSafe(IEngine engine) at Script.Run(IEngine engine)"
But when I execute this script from inside another script, I don't get the ExitFail message from that subscript.
2024/01/18 10:04:11.455|SLAutomation.exe 10.4.2347.224|20848|16116|Script|INF|-1|[Jens Vandewalle] (Script ResourceScheduling_Job DOM Button Actions) Log Message: "(Code: 0x80131500) Skyline.DataMiner.Net.Exceptions.DataMinerException: Run Subscript 'Cost and Billing - Script - Calculate Cost' Failed: 0x80004005 at Skyline.DataMiner.Automation.Engine.InternalLaunchSubScript(String scriptName, List`1 finalOptions, Int32 inheritSubScript, Int32 extendedErrorInfo, Dictionary`2& subScriptOutput, List`1& errorMessages) at Skyline.DataMiner.Automation.SubScriptOptions.StartScript() at ResourceScheduling_Job_DOM_Button_Actions_1.Script.CalculateCostAndBilling() at ResourceScheduling_Job_DOM_Button_Actions_1.Script.HandleRecalculateCostAndBillingAction() at ResourceScheduling_Job_DOM_Button_Actions_1.Script.RunSafe() at ResourceScheduling_Job_DOM_Button_Actions_1.Script.Run(IEngine engine)"
How can I receive the ExitFail message from the subscript?
Hi Jens,
You can retrieve the ExitFail message by setting the "Extended Error Info" flag and then using GetErrorMessages() method.
E.g.,
var script = engine.PrepareSubScript("Cost and Billing - Script - Calculate Cos");
script.ExtendedErrorInfo = true;
script.StartScript();
if (script.HadError)
{
var errors = script.GetErrorMessages();
// Handle errors...
}