Do Vim scripts have a way to halt on any error?

Viewed 71

A simple example:

function! Foo()
    echom 'Starting Foo'
    let x = Bar(123)  " Function does not exist so E117 occurs.
    echom 'Nonetheless, this executes.'
endfunction

Does Vim have a mechanism to abort a function or script if any error occurs -- in other words, something similar in spirit to this setting in bash?

set -o errexit

To clarify, I understand how to wrap error-prone code in try-catch. I'm looking for a general mechanism to get Vim scripts to behave similar to languages like Python, Ruby, Perl, and so forth, where an unhandled error causes execution to screech to a halt.

1 Answers
Related