Problem: Vim9: throw in :def function not caught higher up.
Solution: Set "need_rethrow".
assert_equal(['1', 'wrong', '3'], l)
enddef
+def ThrowFromDef()
+ throw 'getout'
+enddef
+
+func CatchInFunc()
+ try
+ call ThrowFromDef()
+ catch
+ let g:thrown_func = v:exception
+ endtry
+endfunc
+
+def CatchInDef()
+ try
+ ThrowFromDef()
+ catch
+ g:thrown_def = v:exception
+ endtry
+enddef
+
+def Test_try_catch_nested()
+ CatchInFunc()
+ assert_equal('getout', g:thrown_func)
+
+ CatchInDef()
+ assert_equal('getout', g:thrown_def)
+enddef
+
let s:export_script_lines =<< trim END
vim9script
let name: string = 'bob'
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 280,
/**/
279,
/**/
tv->v_type = VAR_NUMBER;
tv->vval.v_number = 0;
++ectx.ec_stack.ga_len;
+ need_rethrow = TRUE;
goto done;
}