:On Error
Choose whether a script continues after an error.
Syntax at a glance
:On Error [ exit | ignore ]
Work example
Stop a release script when a check fails
Use :On Error exit in a disposable script with one deliberate SQL error followed by a marker SELECT.
Check your work The marker is absent and the caller sees an error status.
Open Microsoft Learn for full syntax, permissions, and details for your version.