Hi. Keep in mind I’m not the only on here, though . If you ask for me specifically you may keep some other helpful folks from offering an answer!
You’ll want to use a Try…Catch block (help about_try*). For cmdlets that throw a non-terminating error, you have to use -ErrorAction to convert to a terminating exception, since you can only trap those. For a method, set $ErrorActionPreference=’Stop’ before trying the method, and $ErrorActionPreference=’Continue’ after the method, to put it back to normal.
Error handling is a pretty beefy topic, but hopefully that gets you started.