Skip to content

Commit

Permalink
feature: add more lsp error codes
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: B2ABFAE2-1D95-486F-92AD-FEE85F8F5F94
  • Loading branch information
rgrinberg committed Feb 22, 2022
1 parent f5c8b82 commit 4e9369c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion jsonrpc/src/jsonrpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,15 @@ module Response = struct
| MethodNotFound
| InvalidParams
| InternalError
(* the codes below are LSP specific *)
| ServerErrorStart
| ServerErrorEnd
| ServerNotInitialized
| UnknownErrorCode
| RequestCancelled
| RequestFailed
| ServerCancelled
| ContentModified
| RequestCancelled

let of_int = function
| -32700 -> Some ParseError
Expand All @@ -143,6 +146,8 @@ module Response = struct
| -32001 -> Some UnknownErrorCode
| -32800 -> Some RequestCancelled
| -32801 -> Some ContentModified
| -32802 -> Some ServerCancelled
| -32803 -> Some RequestFailed
| _ -> None

let to_int = function
Expand All @@ -157,6 +162,8 @@ module Response = struct
| UnknownErrorCode -> -32001
| RequestCancelled -> -32800
| ContentModified -> -32801
| ServerCancelled -> -32802
| RequestFailed -> -32803

let t_of_yojson json =
match json with
Expand Down
4 changes: 3 additions & 1 deletion jsonrpc/src/jsonrpc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ module Response : sig
| ServerErrorEnd
| ServerNotInitialized
| UnknownErrorCode
| RequestCancelled
| RequestFailed
| ServerCancelled
| ContentModified
| RequestCancelled
end

type t =
Expand Down

0 comments on commit 4e9369c

Please sign in to comment.