changeset 148:b178f2251982

Only set `v:errmsg` when we throw an actual error.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 07 Dec 2016 21:20:50 -0800
parents d566ec6cd2f7
children f915393ff68d
files autoload/gutentags.vim autoload/gutentags/ctags.vim
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Sat Nov 26 16:33:41 2016 -0800
+++ b/autoload/gutentags.vim	Wed Dec 07 21:20:50 2016 -0800
@@ -4,6 +4,11 @@
 
 " Throw an exception message.
 function! gutentags#throw(message)
+    throw "gutentags: " . a:message
+endfunction
+
+" Throw an exception message and set Vim's error message variable.
+function! gutentags#throwerr(message)
     let v:errmsg = "gutentags: " . a:message
     throw v:errmsg
 endfunction
@@ -354,7 +359,7 @@
             echom "gutentags: The tags file is already being updated, " .
                         \"please try again later."
         else
-            call gutentags#throw("Unknown queue mode: " . a:queue_mode)
+            call gutentags#throwerr("Unknown queue mode: " . a:queue_mode)
         endif
         return
     endif
--- a/autoload/gutentags/ctags.vim	Sat Nov 26 16:33:41 2016 -0800
+++ b/autoload/gutentags/ctags.vim	Wed Dec 07 21:20:50 2016 -0800
@@ -44,7 +44,8 @@
     if l:tags_file_exists && g:gutentags_ctags_check_tagfile
         let l:first_lines = readfile(a:tags_file, '', 1)
         if len(l:first_lines) == 0 || stridx(l:first_lines[0], '!_TAG_') != 0
-            call gutentags#throw("File ".a:tags_file." doesn't appear to be ".
+            call gutentags#throwerr(
+                        \"File ".a:tags_file." doesn't appear to be ".
                         \"a ctags file. Please delete it and run ".
                         \":GutentagsUpdate!.")
             return