VerifiedPubSub.ManifestMismatchError exception (VerifiedPubSub v0.1.0)

Copy Markdown View Source

The error for a message that a subscriber receives from a different manifest.

The compiler did not verify such a message against the manifest of the subscriber. Only the names of its topic and event match, and its payload follows the field declarations of the sender. A dispatch would give a handler a payload shape that the compiler did not check: the one thing that this library exists to prevent.

Two manifests can produce the same wire topic when they share a :pubsub and declare topics that overlap. A manifest checks that its topics are disjoint only within itself, because it cannot see the other manifests at compile time.

Summary

Types

t()

The fields of the error

Types

t()

@type t() :: %VerifiedPubSub.ManifestMismatchError{
  __exception__: term(),
  event: atom(),
  expected: module(),
  got: module(),
  params: map(),
  subscriber: module(),
  topic: atom()
}

The fields of the error:

  • subscriber: the subscriber that receives the message.
  • expected: the manifest that the subscriber is bound to.
  • got: the manifest that declares the message.
  • topic: the name of the topic of the message.
  • event: the event of the message.
  • params: the params of the message.