session_write(): error msg instead of exception

References #174.
This commit is contained in:
Marco Hinz 2015-08-14 11:59:24 +02:00
parent a58f92e781
commit 7f76635fce

View file

@ -235,8 +235,6 @@ endfunction
" Function: #session_write {{{1 " Function: #session_write {{{1
function! startify#session_write(spath) function! startify#session_write(spath)
let ssop = &sessionoptions
try
" if this function is called while being in the Startify buffer " if this function is called while being in the Startify buffer
" (by loading another session or running :SSave/:SLoad directly) " (by loading another session or running :SSave/:SLoad directly)
" switch back to the previous buffer before saving the session " switch back to the previous buffer before saving the session
@ -249,13 +247,19 @@ function! startify#session_write(spath)
" prevent saving already deleted buffers that were in the arglist " prevent saving already deleted buffers that were in the arglist
for arg in argv() for arg in argv()
if !buflisted(arg) if !buflisted(arg)
execute 'argdelete' fnameescape(arg) execute 'silent! argdelete' fnameescape(arg)
endif endif
endfor endfor
let ssop = &sessionoptions
set sessionoptions-=options set sessionoptions-=options
try
execute 'mksession!' a:spath execute 'mksession!' a:spath
catch catch
execute 'echoerr' string(v:exception) echohl ErrorMsg
echomsg v:exception
echohl NONE
return
finally finally
let &sessionoptions = ssop let &sessionoptions = ssop
endtry endtry