Skip to content

Commit 38e61df

Browse files
fix(promises): Do not report keyboard interrupt as unhandled rejection
There's no way to catch when C-c is pressed during the promise, so we need to ignore "Keyboard interrupt" as unhandled error.
1 parent 95d7047 commit 38e61df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/orgmode/utils/promise.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ local new_pending = function(on_fullfilled, on_rejected)
6666
end
6767
self._handled = true
6868
vim.schedule(function()
69-
local values = vim.inspect({ self._value:unpack() }, { newline = '', indent = '' })
69+
local value = self._value:unpack()
70+
-- Do not report keyboard interrupt errors as unhandled.
71+
-- There is no way to handle pressed "<C-c>" while waiting for a promise.
72+
if value == 'Keyboard interrupt' then
73+
return
74+
end
75+
local values = vim.inspect({ value }, { newline = '', indent = '' })
7076
error('unhandled promise rejection: ' .. values, 0)
7177
end)
7278
end

0 commit comments

Comments
 (0)