Skip to content

Commit 424676b

Browse files
authored
Merge pull request #265 from gibbz00/error_codes
Add missing error codes, use doc comments for all of them.
2 parents 2b20769 + 938573d commit 424676b

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

src/error_codes.rs

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,53 @@
22
//! There are other error codes that are defined in the
33
//! [JSON RPC specification](https://www.jsonrpc.org/specification#error_object).
44
5-
// This is the start range of LSP reserved error codes.
6-
// It doesn't denote a real error code.
7-
//
8-
// @since 3.16.0
5+
/// Defined in the LSP specification but in the range reserved for JSON-RPC error codes,
6+
/// namely the -32099 to -32000 "Reserved for implementation-defined server-errors." range.
7+
/// The code has, nonetheless, been left in this range for backwards compatibility reasons.
8+
pub const SERVER_NOT_INITIALIZED: i64 = -32002;
9+
10+
/// Defined in the LSP specification but in the range reserved for JSON-RPC error codes,
11+
/// namely the -32099 to -32000 "Reserved for implementation-defined server-errors." range.
12+
/// The code has, nonetheless, left in this range for backwards compatibility reasons.
13+
pub const UNKNOWN_ERROR_CODE: i64 = -32001;
14+
15+
/// This is the start range of LSP reserved error codes.
16+
/// It doesn't denote a real error code.
17+
///
18+
/// @since 3.16.0
919
pub const LSP_RESERVED_ERROR_RANGE_START: i64 = -32899;
1020

11-
// The server cancelled the request. This error code should
12-
// only be used for requests that explicitly support being
13-
// server cancellable.
14-
//
15-
// @since 3.17.0
21+
/// A request failed but it was syntactically correct, e.g the
22+
/// method name was known and the parameters were valid. The error
23+
/// message should contain human readable information about why
24+
/// the request failed.
25+
///
26+
/// @since 3.17.0
27+
pub const REQUEST_FAILED: i64 = -32803;
28+
29+
/// The server cancelled the request. This error code should
30+
/// only be used for requests that explicitly support being
31+
/// server cancellable.
32+
///
33+
/// @since 3.17.0
1634
pub const SERVER_CANCELLED: i64 = -32802;
1735

18-
// The server detected that the content of a document got
19-
// modified outside normal conditions. A server should
20-
// NOT send this error code if it detects a content change
21-
// in it unprocessed messages. The result even computed
22-
// on an older state might still be useful for the client.
23-
//
24-
// If a client decides that a result is not of any use anymore
25-
// the client should cancel the request.
36+
/// The server detected that the content of a document got
37+
/// modified outside normal conditions. A server should
38+
/// NOT send this error code if it detects a content change
39+
/// in it unprocessed messages. The result even computed
40+
/// on an older state might still be useful for the client.
41+
///
42+
/// If a client decides that a result is not of any use anymore
43+
/// the client should cancel the request.
2644
pub const CONTENT_MODIFIED: i64 = -32801;
2745

28-
// The client has canceled a request and a server as detected
29-
// the cancel.
46+
/// The client has canceled a request and a server as detected
47+
/// the cancel.
3048
pub const REQUEST_CANCELLED: i64 = -32800;
3149

32-
// This is the end range of LSP reserved error codes.
33-
// It doesn't denote a real error code.
34-
//
35-
// @since 3.16.0
50+
/// This is the end range of LSP reserved error codes.
51+
/// It doesn't denote a real error code.
52+
///
53+
/// @since 3.16.0
3654
pub const LSP_RESERVED_ERROR_RANGE_END: i64 = -32800;

0 commit comments

Comments
 (0)