From d6b3e1c67c5645e8d76745bca5bc61652baa7c83 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 10 Jul 2014 22:57:28 -0400 Subject: [PATCH] Silence all callback errors If this is to be made asynchronous, there's not really a good way to display the exception. --- autoload/fireplace/nrepl.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/autoload/fireplace/nrepl.vim b/autoload/fireplace/nrepl.vim index 44bb78e..8d2968b 100644 --- a/autoload/fireplace/nrepl.vim +++ b/autoload/fireplace/nrepl.vim @@ -198,12 +198,15 @@ function! s:nrepl_prepare(msg) dict abort return msg endfunction -function! fireplace#nrepl#callback(body, type, callback) - let response = {'body': a:body, 'type': a:type} - if has_key(g:fireplace_nrepl_sessions, get(a:body, 'session')) - let response.session = g:fireplace_nrepl_sessions[a:body.session] - endif - call call(a:callback[0], [response] + a:callback[1:-1]) +function! fireplace#nrepl#callback(body, type, callback) abort + try + let response = {'body': a:body, 'type': a:type} + if has_key(g:fireplace_nrepl_sessions, get(a:body, 'session')) + let response.session = g:fireplace_nrepl_sessions[a:body.session] + endif + call call(a:callback[0], [response] + a:callback[1:-1]) + catch + endtry endfunction function! s:nrepl_call(msg, ...) dict abort