Skip to content

Commit 4e9369c

Browse files
committed
feature: add more lsp error codes
Signed-off-by: Rudi Grinberg <[email protected]> ps-id: B2ABFAE2-1D95-486F-92AD-FEE85F8F5F94
1 parent f5c8b82 commit 4e9369c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

jsonrpc/src/jsonrpc.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ module Response = struct
124124
| MethodNotFound
125125
| InvalidParams
126126
| InternalError
127+
(* the codes below are LSP specific *)
127128
| ServerErrorStart
128129
| ServerErrorEnd
129130
| ServerNotInitialized
130131
| UnknownErrorCode
131-
| RequestCancelled
132+
| RequestFailed
133+
| ServerCancelled
132134
| ContentModified
135+
| RequestCancelled
133136

134137
let of_int = function
135138
| -32700 -> Some ParseError
@@ -143,6 +146,8 @@ module Response = struct
143146
| -32001 -> Some UnknownErrorCode
144147
| -32800 -> Some RequestCancelled
145148
| -32801 -> Some ContentModified
149+
| -32802 -> Some ServerCancelled
150+
| -32803 -> Some RequestFailed
146151
| _ -> None
147152

148153
let to_int = function
@@ -157,6 +162,8 @@ module Response = struct
157162
| UnknownErrorCode -> -32001
158163
| RequestCancelled -> -32800
159164
| ContentModified -> -32801
165+
| ServerCancelled -> -32802
166+
| RequestFailed -> -32803
160167

161168
let t_of_yojson json =
162169
match json with

jsonrpc/src/jsonrpc.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ module Response : sig
9292
| ServerErrorEnd
9393
| ServerNotInitialized
9494
| UnknownErrorCode
95-
| RequestCancelled
95+
| RequestFailed
96+
| ServerCancelled
9697
| ContentModified
98+
| RequestCancelled
9799
end
98100

99101
type t =

0 commit comments

Comments
 (0)