Good morning,
I have a two Powershell scripts; main.ps1 and sub.ps1. main.ps1 calls sub.ps1. Sometimes sub.ps1 throws an exception. Is it possible to catch the exception thrown by sub.ps1 from main.ps1 ?
Example main.ps1:
try{. .\sub.ps1;} catch {} finally {}
Example sub.ps1:
throw new-object System.ApplicationException "I am an exception";
Regards,