Documentation
¶
Overview ¶
Package catalog is the in-memory registry for CompositeError types and Parsers, populated via init() blocks in per-type packages.
This mirrors pkg/queue/catalog: there is no DB-backed catalog table. On every process start, importing a type's package runs its init() which registers the factory and parser(s) here.
Index ¶
- func AllParsers() []composite_error.Parser
- func Hydrate(typ composite_error.Type, data []byte) (composite_error.CompositeError, error)
- func LookupType(typ composite_error.Type) (func() composite_error.CompositeError, bool)
- func ParsersForContext(c composite_error.ParseContext) []composite_error.Parser
- func RegisterParser(p composite_error.Parser)
- func RegisterType(typ composite_error.Type, fn func() composite_error.CompositeError)
- func Reset()
- func Types() []composite_error.Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllParsers ¶
func AllParsers() []composite_error.Parser
AllParsers returns every registered parser, in registration order. Used by the admin dashboard catalog browser.
func Hydrate ¶
func Hydrate(typ composite_error.Type, data []byte) (composite_error.CompositeError, error)
Hydrate looks up the factory for typ, instantiates an empty value, and unmarshals data into it. Returns an error if the type is not registered or the JSON does not match the type's schema.
func LookupType ¶
func LookupType(typ composite_error.Type) (func() composite_error.CompositeError, bool)
LookupType returns the factory registered for typ, or (nil, false).
func ParsersForContext ¶
func ParsersForContext(c composite_error.ParseContext) []composite_error.Parser
ParsersForContext returns the parsers that should be invoked for a given dispatch context, ordered most-specific to least-specific. Within a level parsers are returned in registration order.
Walking is by "/"-segment ancestry: "terraform/plan" matches parsers registered against "terraform/plan", "terraform", and "" (root).
func RegisterParser ¶
func RegisterParser(p composite_error.Parser)
RegisterParser indexes p under each of its declared ParseContexts. Panics if Contexts() is empty — every parser must opt in to at least one subtree (see specs/composite-errors.md).
func RegisterType ¶
func RegisterType(typ composite_error.Type, fn func() composite_error.CompositeError)
RegisterType associates a CompositeError type with its factory. Panics on duplicate registration — same contract as pkg/queue/catalog.
The factory must return a fresh, zero-valued instance of the implementing struct on each call.
func Types ¶
func Types() []composite_error.Type
Types returns all registered type identifiers, sorted. Useful for the admin dashboard catalog browser.
Types ¶
This section is empty.