File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ async def validate_msg(self, message):
5252 message = str (msg .loc .source .body )
5353 message = message .encode ("utf-8" )
5454 return message
55+ elif hasattr (message , "SerializeToString" ):
56+ msgToSend = message .SerializeToString ()
57+ return msgToSend
5558 elif not isinstance (message , bytearray ) and not isinstance (message , dict ):
5659 raise MemphisSchemaError ("Unsupported message type" )
5760 else :
@@ -78,6 +81,13 @@ def validate_protobuf(self, message):
7881 msgToSend = message .SerializeToString ()
7982 proto_msg .ParseFromString (msgToSend )
8083 proto_msg .SerializeToString ()
84+ try :
85+ proto_msg .ParseFromString (msgToSend )
86+ proto_msg .SerializeToString ()
87+ except Exception as e :
88+ if "parsing message" in str (e ):
89+ e = "Error parsing protobuf message"
90+ raise MemphisSchemaError (str (e ))
8191 return msgToSend
8292
8393 else :
You can’t perform that action at this time.
0 commit comments