VB Scripting - Error Handling
I am aware VB-Scripting is vanishing where PowerShell takes precedence, but still this post is for people who still use VB-script. The post talks about some of the rules that can be implied with error handling. Rules: Explicitly set error handling using the “On Error” statement. Explicit declaration makes it clear that error handling has been considered. Use “On Error GoTo 0” to turn off error handling. With error handling turned off, a VB script will stop immediately upon encountering a run-time error. This should only be used in circumstances where failure of the script is inconsequential. Use “On Error Resume Next” to turn on error handling. With error handling turned on, a VB script will not stop execution. Instead it attempts to run the next line, skipping lines that generate errors and running lines that do not. With error handling turned on, it is important to check Err.Number to trap fatal error conditions. Process errors appropriatel...