Encapsulate disconnection detection
This commit is contained in:
parent
9c48439da7
commit
09a0ed93cf
@ -144,26 +144,22 @@ function! s:repl.path() dict abort
|
|||||||
return self.connection.path()
|
return self.connection.path()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.eval(expr, options) dict abort
|
function! s:repl.try(function, ...) dict abort
|
||||||
try
|
try
|
||||||
let result = self.connection.eval(a:expr, a:options)
|
return call(self.connection[a:function], a:000, self.connection)
|
||||||
catch /^\w\+ Connection Error:/
|
catch /^\w\+ Connection Error:/
|
||||||
call filter(s:repl_paths, 'v:val isnot self')
|
call filter(s:repl_paths, 'v:val isnot self')
|
||||||
call filter(s:repls, 'v:val isnot self')
|
call filter(s:repls, 'v:val isnot self')
|
||||||
throw v:exception
|
throw v:exception
|
||||||
endtry
|
endtry
|
||||||
return result
|
endfunction
|
||||||
|
|
||||||
|
function! s:repl.eval(expr, options) dict abort
|
||||||
|
return self.try('eval', a:expr, a:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.message(...) dict abort
|
function! s:repl.message(...) dict abort
|
||||||
try
|
return call(self.try, ['message'] + a:000, self)
|
||||||
let result = call(self.connection.message, a:000, self.connection)
|
|
||||||
catch /^\w\+ Connection Error:/
|
|
||||||
call filter(s:repl_paths, 'v:val isnot self')
|
|
||||||
call filter(s:repls, 'v:val isnot self')
|
|
||||||
throw v:exception
|
|
||||||
endtry
|
|
||||||
return result
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.require(lib) dict abort
|
function! s:repl.require(lib) dict abort
|
||||||
|
Loading…
Reference in New Issue
Block a user