mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
vim-patch:9.1.0529: silent! causes following try/catch to not work (#29567)
Problem: silent! causes following try/catch to not work
(Malcolm Rowe)
Solution: consider emsg_silent in handle_did_throw() and do not abort
evaluation flow for :silent! (LemonBoy)
The silent! flag causes the evaluation not to be aborted in case of
uncaught exceptions, adjust handle_did_throw to take this detail into
account.
Fixes the long-standing todo.txt item:
```
Problem that a previous silent ":throw" causes a following try/catch not
to work. (ZyX, 2013 Sep 28) With examples: (Malcolm Rowe, 2015 Dec 24)
Also see vim/vim#8487 for an example.
```
fixes: vim/vim#538
closes: vim/vim#15128
749ba0f6d9
Cherry-pick Test_deeply_nested_source() from patch 8.2.5169.
Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
@@ -972,8 +972,13 @@ void handle_did_throw(void)
|
||||
current_exception->throw_name = NULL;
|
||||
|
||||
discard_current_exception(); // uses IObuff if 'verbose'
|
||||
suppress_errthrow = true;
|
||||
force_abort = true;
|
||||
|
||||
// If "silent!" is active the uncaught exception is not fatal.
|
||||
if (emsg_silent == 0) {
|
||||
suppress_errthrow = true;
|
||||
force_abort = true;
|
||||
}
|
||||
|
||||
msg_ext_set_kind("emsg"); // kind=emsg for :throw, exceptions. #9993
|
||||
|
||||
if (messages != NULL) {
|
||||
|
Reference in New Issue
Block a user