NFIBrokerage / spear

A sharp EventStoreDB v20+ client backed by Mint :yum:
https://hex.pm/packages/spear
Apache License 2.0
85 stars 14 forks source link

guard against non-event ReadResps #58

Closed the-mikedavis closed 3 years ago

the-mikedavis commented 3 years ago

closes #54

Adds some guards against the content-type of the ReadResp message to ensure that we don't try to give anything to the library user that can't be decoded.

With the current version of the protobufs (via event_store_db_gpb_protobufs), we decode the trailing stream position messages as:

{:"event_store.client.streams.ReadResp", :undefined}

which fails some pattern matches / function clauses. This pr sets up the necessary function clauses to only allow ReadResps through when they contain events.

the-mikedavis commented 3 years ago

tested locally against https://github.com/EventStore/EventStore/pkgs/container/EventStore%2Feventstore/6949734