Skip to content

Commit

Permalink
More consistent retention of throwpoints
Browse files Browse the repository at this point in the history
Remove the try/catch from within the dispatch call since the entire call
is wrapped already. Move the saving of exception, throwpoint, and
message to the caller so it is more consistent.
  • Loading branch information
natebosch committed Jul 7, 2018
1 parent f095b45 commit fb455ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 1 addition & 9 deletions autoload/lsc/dispatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@ function! lsc#dispatch#message(server, message) abort
elseif has_key(a:message, 'result')
let call_id = a:message['id']
if has_key(s:callbacks, call_id)
try
call s:callbacks[call_id][0](a:message['result'])
catch
call lsc#message#error('Caught '.string(v:exception).
\' while handling '.string(call_id))
let g:lsc_last_error = v:exception
let g:lsc_last_throwpoint = v:throwpoint
let g:lsc_last_error_message = a:message
endtry
call s:callbacks[call_id][0](a:message['result'])
unlet s:callbacks[call_id]
endif
else
Expand Down
3 changes: 3 additions & 0 deletions autoload/lsc/protocol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function! s:consumeMessage(server) abort
call lsc#dispatch#message(a:server, content)
catch
call lsc#message#error('Error dispatching message: '.string(v:exception))
let g:lsc_last_error = v:exception
let g:lsc_last_throwpoint = v:throwpoint
let g:lsc_last_error_message = content
endtry
endif
let remaining_message = message[message_end:]
Expand Down

0 comments on commit fb455ee

Please sign in to comment.