Skip to content

Commit

Permalink
Use :echoerr to report hard errors of the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
xaizek committed Jun 22, 2020
1 parent d7213e4 commit ed8e9ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 2 additions & 4 deletions ftplugin/mail_vifm.vim
@@ -1,6 +1,6 @@
" Mail file type extension to pick files for attachments via vifm
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: January 02, 2018
" Last Change: June 22, 2020

" Insert attachment picked via vifm after 'Subject' header
function! s:AddMailAttachments()
Expand Down Expand Up @@ -41,9 +41,7 @@ endfunction

function! s:HandleRunResults(exitcode, listf)
if a:exitcode != 0
echohl WarningMsg
echo 'Got non-zero code from vifm: ' . a:exitcode
echohl None
echoerr 'Got non-zero code from vifm: ' . a:exitcode
call delete(a:listf)
return
endif
Expand Down
12 changes: 5 additions & 7 deletions plugin/vifm.vim
Expand Up @@ -2,7 +2,7 @@
" Last Change: 2001 November 29

" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: 2020 May 1
" Last Change: 2020 June 22

" vifm and vifm.vim can be found at https://vifm.info/

Expand Down Expand Up @@ -51,7 +51,7 @@ command! -bar -nargs=* -count -complete=dir TabVifm
\ :call s:StartVifm('<mods>', <count>, s:tab_drop_cmd, <f-args>)

function! s:StartVifm(mods, count, editcmd, ...) abort
echohl WarningMsg | echo 'vifm executable wasn''t found' | echohl None
echoerr 'vifm executable wasn''t found'
endfunction

call vifm#globals#Init()
Expand All @@ -77,7 +77,7 @@ endif

function! s:StartVifm(mods, count, editcmd, ...) abort
if a:0 > 2
echohl WarningMsg | echo 'Too many arguments' | echohl None
echoerr 'Too many arguments'
return
endif

Expand Down Expand Up @@ -225,9 +225,7 @@ endfunction

function! s:HandleRunResults(exitcode, listf, typef, editcmd) abort
if a:exitcode != 0
echohl WarningMsg
echo 'Got non-zero code from vifm: ' . a:exitcode
echohl None
echoerr 'Got non-zero code from vifm: ' . a:exitcode
call delete(a:listf)
call delete(a:typef)
return
Expand All @@ -238,7 +236,7 @@ function! s:HandleRunResults(exitcode, listf, typef, editcmd) abort
" running.

if !file_readable(a:listf)
echohl WarningMsg | echo 'Failed to read list of files' | echohl None
echoerr 'Failed to read list of files'
call delete(a:listf)
call delete(a:typef)
return
Expand Down

0 comments on commit ed8e9ba

Please sign in to comment.