From 5d8c4bfc1fa9dc68661b5330096b3fc9cf15c623 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 8 Oct 2016 23:13:36 +0900 Subject: [PATCH] Print exception from post-update hook with : prefix --- plug.vim | 6 +++++- test/workflow.vader | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index f48a15b..2d22299 100644 --- a/plug.vim +++ b/plug.vim @@ -809,7 +809,11 @@ function! s:do(pull, force, todo) if type == s:TYPE.string if spec.do[0] == ':' call s:load_plugin(spec) - execute spec.do[1:] + try + execute spec.do[1:] + catch + let error = v:exception + endtry if !s:plug_window_exists() cd - throw 'Warning: vim-plug was terminated by the post-update hook of '.name diff --git a/test/workflow.vader b/test/workflow.vader index 458d19f..274927b 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -970,6 +970,16 @@ Execute (Vim command with : prefix closing the window): Assert out =~ 'vim-plug was terminated' Assert out =~ 'of vim-pseudocl' +Execute (Invalid vim command in post-update hook): + call plug#begin() + Plug 'junegunn/vim-pseudocl', { 'do': ':nosuchcommand' } + call plug#end() + + PlugInstall! + Log getline(1, '$') + AssertExpect! 'x Post-update hook for vim-pseudocl ... Vim:E492: Not an editor command: nosuchcommand', 1 + q + ********************************************************************** ~ Overriding `dir` **********************************************************************