patch 9.1.0984: exception handling can be improved

Problem:  exception handling can be improved
Solution: add v:stacktrace and getstacktrace()

closes: #16360

Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: ichizok <gclient.gaap@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
ichizok
2025-01-02 18:06:00 +01:00
committed by Christian Brabandt
parent fd771613b3
commit 663d18d610
17 changed files with 285 additions and 21 deletions

View File

@ -279,6 +279,7 @@ getregionpos({pos1}, {pos2} [, {opts}])
List get a list of positions for a region
getregtype([{regname}]) String type of a register
getscriptinfo([{opts}]) List list of sourced scripts
getstacktrace() List get current stack trace of Vim scripts
gettabinfo([{expr}]) List list of tab pages
gettabvar({nr}, {varname} [, {def}])
any variable {varname} in tab {nr} or {def}
@ -4997,6 +4998,21 @@ getscriptinfo([{opts}]) *getscriptinfo()*
Return type: list<dict<any>>
getstacktrace() *getstacktrace()*
Returns the current stack trace of Vim scripts.
Stack trace is a |List|, of which each item is a |Dictionary|
with the following items:
funcref The funcref if the stack is at the function,
otherwise this item is not exist.
event The string of the event description if the
stack is at autocmd event, otherwise this item
is not exist.
lnum The line number of the script on the stack.
filepath The file path of the script on the stack.
Return type: list<dict<any>>
gettabinfo([{tabnr}]) *gettabinfo()*
If {tabnr} is not specified, then information about all the
tab pages is returned as a |List|. Each List item is a