declearn.communication.utils.verify_server_message_validity
Verify that a received serialized message matches expected type.
- If the received message matches expected type, deserialize it.
- If the recevied message is an unexpected
Error
message, raise. - If it belongs to any other type, send an
Error
to the server, then raise.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
netwk |
NetworkClient
|
|
required |
received |
SerializedMessage
|
Received |
required |
expected |
Type[MessageT]
|
Expected |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
MessageT
|
Deserialized |
Raises:
Type | Description |
---|---|
ErrorMessageException
|
If |
MessageTypeException
|
If |
Source code in declearn/communication/utils/_parse.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|