Thursday, March 31, 2011

What is supposed to happen if there is an error in a vim script?

> However none of you answered,
> anywhere in the available documentation?
> Not just mentioned in passing by an example!

> Where are the rules for this detailed?

Actually the documentation does describe, in detail, the rules for handling
errors, exceptions, and interrupts -- if the author of a script encloses it in
a ``try'' block. You can find these explanations in the document eval.txt in
Section 8 ``Exception Handling''. You can also use help commands to locate
descriptionfor the ``catch'' ``throw'' and ``finally'' commands within
``try'' and ``endtry'' blocks.

I had to deal with this recently myself when I wrote a few scripts,.
Frankly, I found these rules unnecessarily complex and, well, arcane compared
to error handling in other script languages (e.g., unix shells).

Vim provides a set of rules for the Author of a script to deal with errors,
should he or she choose to do so. However, if the author does not use the
``try'' mechanism - I fear errors are handled -well - however the developers
happened to handle each particular error. Generally, error messages are
displayed and some action may or may not be taken.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: