CloudEvents errors¶
Returned by gitlab.com/phpboyscout/go/envelope-cloudevents, and only by it. Their codes keep the
module's prefix, cloudevents., so a counter by code tells the formats apart.
ErrAmbiguousHeader¶
One attribute arrived twice with different values, as two spellings that fold to the same key, or
as two values under one key. A Wire.ContentType that differs from a content-type header counts.
In structured mode, a JSON member that appears twice is refused whatever its values, and so is a body
carrying both data and data_base64.
Only the binding's prefixed headers and content-type are considered. X-Forwarded-For with two
hops is the ordinary shape behind a proxy and is none of the format's business: it is returned in
Foreign.Headers.
Like every other refusal, this one returns the partial event: the ambiguous attribute is untrustworthy, everything else that was readable is not.
ErrReadsAsStructured¶
Binary(b).Encode was given an event whose datacontenttype starts application/cloudevents, the
prefix every binding reserves for structured mode. A reader accepting both modes would refuse it as
ErrAmbiguous, so the publisher hears instead. Publish it with Structured(), or give it a content
type such as application/json.
ErrInvalidJSON¶
A structured-mode body is not one JSON object of CloudEvents members: not an object at all, data
after it, an attribute that is not a string, an extension that is an object or array, or a
data_base64 that is not base64.
Every other refusal a CloudEvents format returns is a go/envelope sentinel, listed in Errors.