patch 8.2.3798: a :def callback function postpones an error message
Problem: A :def callback function postpones an error message.
Solution: Display the error after calling the function. (closes #9340)
diff --git a/src/userfunc.c b/src/userfunc.c
index da33ba0..cc921f5 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3173,6 +3173,15 @@
++callback_depth;
ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe);
--callback_depth;
+
+ // When a :def function was called that uses :try an error would be turned
+ // into an exception. Need to give the error here.
+ if (need_rethrow && current_exception != NULL)
+ {
+ need_rethrow = FALSE;
+ handle_did_throw();
+ }
+
return ret;
}