Tuesday, November 5, 2013

Re: Can I return a Vim error from a function?

On Nov 5, 2013, at 4:19 PM, Marc Weber <marco-oweber@gmx.de> wrote:

> fun! Foo() abort
> endf
>
> Is a way to make Vim not continue on any error.
>
> There is
> throw "error"
> and try .. catch /*.*/ end (v:exception) or such
>
> Thus throw or abort are the correct ways to propagate an error, thus
> make a function return.
>
> If you want something else clarify.

Thanks. I tried abort, and it --as the docs said it would -- caught the first Vim exception thrown, and halted execution. I guess I'd want throw or something similar here (I want to catch a specific error and pass it on to the user, ending when it is caught, rather than doing so for *any* potential error.

--
b

Sent from my iPhone

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment