From cbbd7e8b6a5f59cff1c3af7fd825fe21b0fc01a7 Mon Sep 17 00:00:00 2001 From: glacambre Date: Sun, 28 Apr 2024 14:46:50 +0200 Subject: [PATCH] firenvim.vim: catch settings misconfiguration and turn into message --- autoload/firenvim.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/autoload/firenvim.vim b/autoload/firenvim.vim index cbcb9f2d..f70e1d97 100644 --- a/autoload/firenvim.vim +++ b/autoload/firenvim.vim @@ -201,7 +201,18 @@ function! firenvim#run() abort let l:result['port'] = l:port endif - call WriteStdout(a:id, json_encode(result)) + let l:response = '' + try + let l:response = json_encode(result) + catch /E474/ + call remove(result, 'settings') + if !has_key(result, 'messages') + let result['messages'] = [] + endif + call add(result['messages'], 'Error serializing settings:' . v:exception) + let l:response = json_encode(result) + endtry + call WriteStdout(a:id, l:response) endfunction if exists('g:firenvim_c') for data in g:firenvim_i