File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -69,20 +69,24 @@ export async function sendRequestWithRetry<TParam, TRet>(
69
69
return await ( token
70
70
? client . sendRequest ( reqType , param , token )
71
71
: client . sendRequest ( reqType , param ) ) ;
72
- } catch ( error ) {
72
+ } catch ( error : unknown ) {
73
73
if ( delay === null ) {
74
74
log . warn ( "LSP request timed out" , { method : reqType . method , param, error } ) ;
75
75
throw error ;
76
76
}
77
- if ( error . code === lc . LSPErrorCodes . RequestCancelled ) {
78
- throw error ;
79
- }
80
77
81
- if ( error . code !== lc . LSPErrorCodes . ContentModified ) {
82
- log . warn ( "LSP request failed" , { method : reqType . method , param, error } ) ;
83
- throw error ;
78
+ if ( error instanceof lc . ResponseError ) {
79
+ switch ( error . code ) {
80
+ case lc . LSPErrorCodes . RequestCancelled :
81
+ throw error ;
82
+ case lc . LSPErrorCodes . ContentModified :
83
+ await sleep ( delay ) ;
84
+ continue ;
85
+ }
84
86
}
85
- await sleep ( delay ) ;
87
+
88
+ log . warn ( "LSP request failed" , { method : reqType . method , param, error } ) ;
89
+ throw error ;
86
90
}
87
91
}
88
92
throw "unreachable" ;
You can’t perform that action at this time.
0 commit comments