Skip to content

Commit

Permalink
refactor: serialization catches new avro.errors.InvalidAvroBinaryEnco…
Browse files Browse the repository at this point in the history
…ding

Serialization is changed to catch avro.errors.InvalidAvroBinaryEncoding
when data record payload is invalid.
See https://issues.apache.org/jira/browse/AVRO-3380
  • Loading branch information
jjaakola-aiven committed Dec 29, 2022
1 parent d5b9e37 commit da765ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion karapace/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ async def deserialize(self, bytes_: bytes) -> dict:
raise InvalidPayload("No schema with ID from payload")
ret_val = read_value(self.config, schema, bio)
return ret_val
except (UnicodeDecodeError, TypeError) as e:
except (UnicodeDecodeError, TypeError, avro.errors.InvalidAvroBinaryEncoding) as e:
raise InvalidPayload("Data does not contain a valid message") from e
except avro.errors.SchemaResolutionException as e:
raise InvalidPayload("Data cannot be decoded with provided schema") from e
Expand Down

0 comments on commit da765ae

Please sign in to comment.