File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed
Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -45,20 +45,25 @@ async function startDevelop() {
4545 ) ;
4646 const rpc = async ( cmd : string , args : unknown [ ] ) => {
4747 // console.log('RPC:', cmd, args);
48- const res = await fetch ( `http://localhost:${ port } /~api` , {
49- method : 'POST' ,
50- headers : {
51- 'content-type' : 'application/json' ,
52- } ,
53- body : JSON . stringify ( {
54- cmd,
55- args,
56- } ) ,
57- } ) ;
58- if ( ! res . ok ) {
59- console . error ( `Error: ${ res . status } ` ) ;
48+ try {
49+ const res = await fetch ( `http://localhost:${ port } /~api` , {
50+ method : 'POST' ,
51+ headers : {
52+ 'content-type' : 'application/json' ,
53+ } ,
54+ body : JSON . stringify ( {
55+ cmd,
56+ args,
57+ } ) ,
58+ } ) ;
59+ if ( ! res . ok ) {
60+ throw new Error ( `Request error: ${ res . status } ` ) ;
61+ }
62+ return true ;
63+ } catch ( err ) {
64+ console . error ( err ) ;
65+ return false ;
6066 }
61- return res . ok ;
6267 } ;
6368 const { nvim } = workspace ;
6469 const buffer = await nvim . buffer ;
You can’t perform that action at this time.
0 commit comments