You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Get the Port's ID assigned by the [`RpcServer`](`crate::server::RpcServer`)
165
+
pubfnport_id(&self) -> u32{
166
+
self.port_id
167
+
}
168
+
164
169
/// Sends a request to the [`RpcServer`](crate::server::RpcServer) requesting a remote module so then the returned module is loaded into memory so that it can be used by the client.
165
170
///
166
171
/// It returns a `impl ServiceClient` that should auto generated by the codegen
@@ -380,6 +382,7 @@ type StreamPackage = (RpcMessageTypes, u32, StreamMessage);
380
382
/// It's the data structure that actually owns the Transport attached to a `RpcClient`. The transport is drilled down up to get to `ClientMEssagesHandler`
Copy file name to clipboardExpand all lines: rpc/src/server.rs
+30-17Lines changed: 30 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -41,13 +41,13 @@ pub enum ServerError {
41
41
/// Error on decoding bytes (`Vec<u8>`) into a given type using [`crate::rpc_protocol::parse::parse_protocol_message`] or using the [`Message::decode`]
42
42
ProtocolError,
43
43
/// Port was not found in the server state, possibly not created
44
-
PortNotFound,
44
+
PortNotFound(u32),
45
45
/// Error on loading a Module, unlikely to happen
46
46
LoadModuleError,
47
47
/// Module was not found, not registered in the server
48
-
ModuleNotFound,
48
+
ModuleNotFound(String),
49
49
/// Given procedure's ID was not found
50
-
ProcedureNotFound,
50
+
ProcedureNotFound(u32),
51
51
/// Unexpexted Error while responding back or Error on sending the original procedure response
52
52
///
53
53
/// This error should be use as a "re-try" when a [`Transport::send`] failed.
@@ -58,9 +58,9 @@ impl RemoteErrorResponse for ServerError {
58
58
fnerror_code(&self) -> u32{
59
59
matchself{
60
60
Self::ProtocolError => 1,
61
-
Self::PortNotFound => 2,
62
-
Self::ModuleNotFound => 3,
63
-
Self::ProcedureNotFound => 4,
61
+
Self::PortNotFound(_) => 2,
62
+
Self::ModuleNotFound(_) => 3,
63
+
Self::ProcedureNotFound(_) => 4,
64
64
Self::UnexpectedErrorOnTransport => 5,
65
65
Self::LoadModuleError => 0,// it's unlikely to happen
66
66
}
@@ -69,10 +69,10 @@ impl RemoteErrorResponse for ServerError {
69
69
fnerror_message(&self) -> String{
70
70
matchself{
71
71
Self::ProtocolError => "Error on parsing a message. The content seems to be corrupted and not to meet the protocol requirements".to_string(),
72
-
Self::PortNotFound => "The given Port's IDwas not found".to_string(),
72
+
Self::PortNotFound(id) => format!("The given Port's ID: {id} was not found"),
73
73
Self::LoadModuleError => "Error on loading a module".to_string(),
74
-
Self::ModuleNotFound => "Module wasn't found on the server, check the name".to_string(),
75
-
Self::ProcedureNotFound => "Procedure's IDwasn't found on the server".to_string(),
74
+
Self::ModuleNotFound(module_name) => format!("Module wasn't found on the server, check the name: {module_name}"),
75
+
Self::ProcedureNotFound(id) => format!("Procedure's ID: {id} wasn't found on the server"),
76
76
Self::UnexpectedErrorOnTransport => "Error on the transport while sending the original procedure response".to_string()
0 commit comments