From 1b30d5c959a03634172dabc8f00f66ff46c9cfcc 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..0009148a 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