Documentation
¶
Overview ¶
Package hook provides error constructors for hook template operations.
Index ¶
- func EmbeddedTemplateNotFound(hook, variant string) error
- func OverrideExists(path, hook, variant string) error
- func RemoveOverride(path string, cause error) error
- func Unknown(hook string) error
- func UnknownVariant(variant, hook string) error
- func Validate(hookExists bool, hook, variant string) error
- func WriteOverride(path string, cause error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmbeddedTemplateNotFound ¶
EmbeddedTemplateNotFound returns an error when an embedded hook message template cannot be located.
Parameters:
- hook: hook name
- variant: template variant name
Returns:
- error: "embedded template not found for <hook>/<variant>"
func OverrideExists ¶
OverrideExists returns an error when a message override already exists and must be reset before editing.
Parameters:
- path: existing override file path
- hook: hook name
- variant: template variant name
Returns:
- error: "override already exists at <path>..."
func RemoveOverride ¶
RemoveOverride wraps a message override removal failure.
Parameters:
- path: the override file path
- cause: the underlying error
Returns:
- error: "failed to remove override <path>: <cause>"
func Unknown ¶
Unknown returns an error for an unrecognized hook name.
Parameters:
- hook: the unknown hook name
Returns:
- error: "unknown hook: <hook>..."
func UnknownVariant ¶
UnknownVariant returns an error for an unrecognized variant within a known hook.
Parameters:
- variant: the unknown variant name
- hook: the parent hook name
Returns:
- error: "unknown variant <variant> for hook <hook>..."
func Validate ¶
Validate returns an error for an unknown hook/variant combination. It distinguishes between an entirely unknown hook and an unknown variant within a known hook.
Parameters:
- hookExists: whether the hook name is recognized
- hook: the hook name
- variant: the variant name
Returns:
- error: descriptive error with guidance to list available options
func WriteOverride ¶
WriteOverride wraps a message override write failure.
Parameters:
- path: the override file path
- cause: the underlying error
Returns:
- error: "failed to write override <path>: <cause>"
Types ¶
This section is empty.