hook

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hook provides error constructors for hook template operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmbeddedTemplateNotFound

func EmbeddedTemplateNotFound(hook, variant string) error

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

func OverrideExists(path, hook, variant string) error

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

func RemoveOverride(path string, cause error) error

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

func Unknown(hook string) error

Unknown returns an error for an unrecognized hook name.

Parameters:

  • hook: the unknown hook name

Returns:

  • error: "unknown hook: <hook>..."

func UnknownVariant

func UnknownVariant(variant, hook string) error

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

func Validate(hookExists bool, hook, variant string) error

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

func WriteOverride(path string, cause error) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL