1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 01:40:05 +08:00

perf(spinners): handle spinners function error

This commit is contained in:
wsdjeg 2023-09-06 13:21:43 +08:00
parent 24803f4de0
commit b0611b5330

View File

@ -8,6 +8,8 @@
local M = {}
local log = require('spacevim.logger').derive('spinners')
M._data = {
dot1 = {
frames = { '', '', '', '', '', '', '', '', '', '' },
@ -24,7 +26,13 @@ function M.Onframe(...)
else
M.index = 1
end
M.func(M.spinners[M.index])
if type(M.func) == 'function' then
local ok, err = pcall(M.func, M.spinners[M.index])
if not ok then
log.debug('failed to call spinners functions:\n')
log.debug(err)
end
end
end
function M.stop()