diff options
Diffstat (limited to 'crates/server/src/dispatch.rs')
-rw-r--r-- | crates/server/src/dispatch.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/server/src/dispatch.rs b/crates/server/src/dispatch.rs index 381649859..bfdbd30ca 100644 --- a/crates/server/src/dispatch.rs +++ b/crates/server/src/dispatch.rs | |||
@@ -10,7 +10,7 @@ use drop_bomb::DropBomb; | |||
10 | use ::{ | 10 | use ::{ |
11 | Result, | 11 | Result, |
12 | req::{ClientRequest, Notification}, | 12 | req::{ClientRequest, Notification}, |
13 | io::{Io, RawMsg, RawResponse, RawRequest, RawNotification}, | 13 | io::{RawResponse, RawRequest, RawNotification}, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | pub struct Responder<R: ClientRequest> { | 16 | pub struct Responder<R: ClientRequest> { |
@@ -113,9 +113,9 @@ pub fn send_notification<N>(params: N::Params) -> RawNotification | |||
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | pub fn unknown_method(id: u64) -> Result<RawResponse> { | ||
117 | error_response(id, ErrorCode::MethodNotFound, "unknown method") | ||
116 | 118 | ||
117 | pub fn unknown_method(io: &mut Io, raw: RawRequest) -> Result<()> { | ||
118 | error(io, raw.id, ErrorCode::MethodNotFound, "unknown method") | ||
119 | } | 119 | } |
120 | 120 | ||
121 | fn error_response(id: u64, code: ErrorCode, message: &'static str) -> Result<RawResponse> { | 121 | fn error_response(id: u64, code: ErrorCode, message: &'static str) -> Result<RawResponse> { |
@@ -135,13 +135,6 @@ fn error_response(id: u64, code: ErrorCode, message: &'static str) -> Result<Raw | |||
135 | Ok(resp) | 135 | Ok(resp) |
136 | } | 136 | } |
137 | 137 | ||
138 | fn error(io: &mut Io, id: u64, code: ErrorCode, message: &'static str) -> Result<()> { | ||
139 | let resp = error_response(id, code, message)?; | ||
140 | io.send(RawMsg::Response(resp)); | ||
141 | Ok(()) | ||
142 | } | ||
143 | |||
144 | |||
145 | #[allow(unused)] | 138 | #[allow(unused)] |
146 | enum ErrorCode { | 139 | enum ErrorCode { |
147 | ParseError = -32700, | 140 | ParseError = -32700, |