vim-denops / denops.vim

🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno

Home Page:https://vim-denops.github.io/denops-documentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Could you check if #113 fix the issue as well? I rewrote that PR and fix both #112 and #114 @tennashi