Loading ...
Sorry, an error occurred while loading the content.

[BUG] Two :silent! bugs: silencing exception disables :try/:catch and it does not work for :throw

Expand Messages
  • ZyX
    Try sourcing the following script function Fu() throw 1234 endfunction silent! call Fu() try|let b=au#xxx()|catch|echomsg v:exception|endtry . After you source
    Message 1 of 3 , Sep 28, 2013
    • 0 Attachment
      Try sourcing the following script

      function Fu()
      throw 1234
      endfunction
      silent! call Fu()
      try|let b=au#xxx()|catch|echomsg v:exception|endtry

      . After you source it with “vim -u NONE -N -S script-name.vim” you will see

      Error detected while processing /tmp/zshubfJ7j:
      line 5:
      E117: Unknown function: au#xxx
      E15: Invalid expression: au#xxx()|catch|echomsg v:exception|endtry

      while expected to see just

      Vim(let):E117: Unknown function: au#xxx

      . If you replace “let b=au#xxx()” with “throw 1234” exception is caught as expected.

      Also note that “:silent! throw 1234” does not silence the exception.


      Note: while :try/:catch does not work after you experienced this problem you still may use :redir to get error messages silenced with :silent!.

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Apparently some flag is set that is not reset as expected. The exception handling is complicated. ... -- Intelligence has much less practical application
      Message 2 of 3 , Sep 28, 2013
      • 0 Attachment
        ZyX wrote:

        > Try sourcing the following script
        >
        > function Fu()
        > throw 1234
        > endfunction
        > silent! call Fu()
        > try|let b=au#xxx()|catch|echomsg v:exception|endtry
        >
        > . After you source it with “vim -u NONE -N -S script-name.vim” you will see
        >
        > Error detected while processing /tmp/zshubfJ7j:
        > line 5:
        > E117: Unknown function: au#xxx
        > E15: Invalid expression: au#xxx()|catch|echomsg v:exception|endtry
        >
        > while expected to see just
        >
        > Vim(let):E117: Unknown function: au#xxx
        >
        > . If you replace “let b=au#xxx()” with “throw 1234”
        > exception is caught as expected.

        Apparently some flag is set that is not reset as expected.
        The exception handling is complicated.

        > Also note that “:silent! throw 1234” does not silence the exception.
        >
        >
        > Note: while :try/:catch does not work after you experienced this
        > problem you still may use :redir to get error messages silenced with
        > :silent!.



        --
        "Intelligence has much less practical application than you'd think."
        -- Scott Adams, Dilbert.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Nikolay Pavlov
        ... see ... This looks more like some incremented/decremented int option: no matter how many try/catch blocks you have after this happened, they all fail to
        Message 3 of 3 , Sep 28, 2013
        • 0 Attachment


          On Sep 29, 2013 12:24 AM, "Bram Moolenaar" <Bram@...> wrote:
          >
          >
          > ZyX wrote:
          >
          > > Try sourcing the following script
          > >
          > >     function Fu()
          > >     throw 1234
          > >     endfunction
          > >     silent! call Fu()
          > >     try|let b=au#xxx()|catch|echomsg v:exception|endtry
          > >
          > > . After you source it with “vim -u NONE -N -S script-name.vim” you will see
          > >
          > >     Error detected while processing /tmp/zshubfJ7j:
          > >     line    5:
          > >     E117: Unknown function: au#xxx
          > >     E15: Invalid expression: au#xxx()|catch|echomsg v:exception|endtry
          > >
          > > while expected to see just
          > >
          > >     Vim(let):E117: Unknown function: au#xxx
          > >
          > > . If you replace “let b=au#xxx()” with “throw 1234”
          > > exception is caught as expected.
          >
          > Apparently some flag is set that is not reset as expected.
          > The exception handling is complicated.

          This looks more like some incremented/decremented int option: no matter how many try/catch blocks you have after this happened, they all fail to catch error messages. I have not debugged the issue yet though.

          > > Also note that “:silent! throw 1234” does not silence the exception.
          > >
          > >
          > > Note: while :try/:catch does not work after you experienced this
          > > problem you still may use :redir to get error messages silenced with
          > > :silent!.
          >
          >
          >
          > --
          > "Intelligence has much less practical application than you'd think."
          >                   -- Scott Adams, Dilbert.
          >
          >  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
          > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
          >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

          --
          --
          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
           
          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.