2012/11/29 Ben Fritz <[email protected]>: > On Wednesday, November 28, 2012 4:05:18 PM UTC-6, Techlive Zheng wrote: >> I know we can use `try..catch` structure to customize error handling in >> scripts, but is there any way to catch an error of user executed command not >> scripts? E.g. if the last file in the argulist has not been edited, then >> executing `quit` command would fail with error "E173: * more file to edit", >> is it possible to catch such an error and do something with it int the >> script? > > Have you tried using :try ... :catch like you would in a script? > > :help :try gives these examples: > > :try | sleep 100 | catch /^Vim:Interrupt$/ | endtry > :try | edit | catch /^Vim(edit):E\d\+/ | echo "error" | endtry > > -- > You received this message from the "vim_dev" 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
What I want accomplish is something like a error listener, if certain type of error raises, then the defined action will be triggerd. The end user do not need to care about using `try...catch` in their command, they just fire up any command they want, and let script handle the rest. This is easy for script-defined command, but how to catch a error that a system command raises? -- You received this message from the "vim_dev" 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
