The failure callback will be executed if the success callback of `denops#request_async()` throws an exception.
tennashi opened this issue · comments
denops/sample/main.ts
import { Denops } from "https://deno.land/x/denops_std/mod.ts";
export function main(denops: Denops): Promise<void> {
denops.dispatcher = {
test(): Promise<string> {
return Promise.resolve("test done")
}
}
return Promise.resolve();
}
plugin/sample.vim
function! Hoge()
call denops#request_async("sample", "test", [], function("s:on_success"), function("s:on_failure"))
endfunction
function! s:on_success(...)
echom a:000
throw "hoge"
endfunction
function! s:on_failure(...)
echom a:000
endfunction
When I wrote the above and executed the Hoge()
function, I got the following output
:call Hoge()
s:on_success
['test done']
s:on_failure
[{}]
The empty output after on_failure is due to issue #112.