On 07/05/12 04:08, John Beckett wrote:
At ':help :catch' we see this example to catch error E123:
     :catch /^Vim\%((\a\+)\)\=:E123/

Isn't the above wrong? Why not just:
     :catch /E123:/

The help example has ':E123' but it means 'E123:'?

What is the '^Vim...' stuff for? The messages on my system do
not start with 'Vim' (use :s/xxx/xxx/ on an empty line to see
error E486, or :xxx to see error E492).

Other examples at ':help :catch' seem wrong to me. The list is:
  :catch /^Vim:Interrupt$/          " catch interrupts (CTRL-C)
  :catch /^Vim\%((\a\+)\)\=:E/      " catch all Vim errors
  :catch /^Vim\%((\a\+)\)\=:/       " catch errors and interrupts
  :catch /^Vim(write):/             " catch all errors in :write
  :catch /^Vim\%((\a\+)\)\=:E123/   " catch error E123

Is a change needed at ':help :catch'?

John



The exception string as caught by :catch is not identical to the error string as displayed at the bottom of the screen if there is no :try

The current exception can be got from v:exception, but only between :catch and :endtry. OTOH the latest error can be got from v:error.

Catching /E123:/ will catch the E123 exception thrown by Vim, but also any exception with "E123:" in its text, thrown by :throw or triggered as an error by :echoerr.


Best regards,
Tony.
--
If Jesus Christ were to come today, people would not even crucify him.
They would ask him to dinner, and hear what he had to say, and make fun
of it.
                -- Thomas Carlyle

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

Reply via email to