rpc_router/rpc_message/
rpc_request_parsing_error.rs1use serde::Serialize;
2use serde_json::Value;
3use serde_with::{DisplayFromStr, serde_as};
4
5#[serde_as]
17#[derive(Debug, Serialize)]
18pub enum RpcRequestParsingError {
19 RequestInvalidType {
20 actual_type: String,
21 },
22
23 ParamsInvalidType {
24 actual_type: String,
25 },
26
27 VersionMissing {
28 id: Option<Value>, method: Option<String>,
30 },
31 VersionInvalid {
32 id: Option<Value>, method: Option<String>,
34 version: Value,
35 },
36
37 MethodMissing {
38 id: Option<Value>, },
40 MethodInvalidType {
41 id: Option<Value>, method: Value,
43 },
44
45 NotificationHasId {
46 method: Option<String>,
47 id: Value,
48 },
49
50 MethodInvalid {
51 actual: String,
52 },
53
54 IdMissing {
55 method: Option<String>,
56 },
57 IdInvalid {
58 actual: String,
59 cause: String,
60 },
61
62 Parse(#[serde_as(as = "DisplayFromStr")] serde_json::Error), }
64
65impl core::fmt::Display for RpcRequestParsingError {
66 fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::result::Result<(), core::fmt::Error> {
67 write!(fmt, "{self:?}")
68 }
69}
70
71impl std::error::Error for RpcRequestParsingError {}