From b33626c63be73114d72b8835756b9da538698ba2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 23 Feb 2024 14:32:04 +0800 Subject: [PATCH] fix(git): make error message clear --- bundle/git.vim/lua/git/init.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bundle/git.vim/lua/git/init.lua b/bundle/git.vim/lua/git/init.lua index 4859338eb..12afdca05 100644 --- a/bundle/git.vim/lua/git/init.lua +++ b/bundle/git.vim/lua/git/init.lua @@ -3,10 +3,18 @@ local M = {} local log = require('git.log') function M.run(command, ...) - local argv = {...} + local argv = { ... } local ok, cmd = pcall(require, 'git.command.' .. command) - if ok and type(cmd.run) == "function" then - cmd.run(argv) + if ok then + if type(cmd.run) == 'function' then + cmd.run(argv) + else + vim.api.nvim_echo( + { { 'git.command.' .. command .. '.run is not function', 'WarningMsg' } }, + false, + {} + ) + end else error(cmd) end