FundingCircle / jackdaw

A Clojure library for the Apache Kafka distributed streaming platform.
https://fundingcircle.github.io/jackdaw/
BSD 3-Clause "New" or "Revised" License
369 stars 80 forks source link

[TDI-1361] make the avro serialization exception message more verbose #316

Closed apanourgiasfc closed 2 years ago

apanourgiasfc commented 2 years ago

Avro error messages now include the relevant path and topic.

On type errors:

On any other error (e.g missing/unknown):

Error message examples

Incorrect Union type - :my-attribute is an enum and we supply a string:

{:message "java.lang.String is not a valid type for union [NULL, ENUM]", :path [:my-attribute], :data "Something", :topic "topic-name-1"}

Incorrect type for nested field :name of map :person:

{:message "java.lang.Long is not a valid type for string", :topic "topic-name-1", :path [:person :name], :data 123}

Unknown field :application-id2 in top level:

{:message "Field application_id2 not known in topic_name", :topic "topic-name-1", :path []}

Unknown nested field :name2 in :person map:

{:message "Field name2 not known in topic_name", :topic "topic-name-1", :path [:person], :data {:name "John", :name2 "dasds", :surname "Doe"}, :path [:person]}

Missing required field :message-id in top level:

{:message "Field message_id type:STRING pos:0 not set and has no default value", :topic "topic-name-1", :path []}

Missing nested required field :name in :person map:

{:message "Field name type:STRING pos:0 not set and has no default value", :topic "topic-name-1", :path [:person]}
99-not-out commented 2 years ago

LGTM