mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
feat(lua): enable stack traces in error output (#16228)
This commit is contained in:
@@ -155,12 +155,20 @@ function module.pcall_err_withfile(fn, ...)
|
||||
return errmsg
|
||||
end
|
||||
|
||||
function module.pcall_err(fn, ...)
|
||||
function module.pcall_err_withtrace(fn, ...)
|
||||
local errmsg = module.pcall_err_withfile(fn, ...)
|
||||
|
||||
return errmsg:gsub('.../helpers.lua:0: ', '')
|
||||
end
|
||||
|
||||
function module.pcall_err(...)
|
||||
return module.remove_trace(module.pcall_err_withtrace(...))
|
||||
end
|
||||
|
||||
function module.remove_trace(s)
|
||||
return (s:gsub("\n%s*stack traceback:.*", ""))
|
||||
end
|
||||
|
||||
-- initial_path: directory to recurse into
|
||||
-- re: include pattern (string)
|
||||
-- exc_re: exclude pattern(s) (string or table)
|
||||
|
Reference in New Issue
Block a user