errors

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors defines custom error types for make-help.

All error types implement the standard error interface and provide actionable suggestions in their error messages to help users resolve issues.

Error Types

  • MixedCategorizationError: Returned when categorized and uncategorized targets are mixed without --default-category

  • UnknownCategoryError: Returned when --category-order references a category that doesn't exist; includes list of available categories

  • MakefileNotFoundError: Returned when the specified Makefile doesn't exist at the given path

  • MakeExecutionError: Returned when a make command fails; includes the stderr output for debugging

  • DuplicateHelpTargetError: Returned when add-target finds an existing help target

  • ValidationError: Returned when Makefile validation fails (e.g., syntax errors detected by make -n)

Usage

All error types have constructor functions (NewXxxError) that create properly initialized error instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateHelpTargetError

type DuplicateHelpTargetError struct {
	// Location describes where the existing help target was found.
	Location string
}

DuplicateHelpTargetError is returned when --create-help-target is run but a help target already exists.

func NewDuplicateHelpTargetError

func NewDuplicateHelpTargetError(location string) *DuplicateHelpTargetError

NewDuplicateHelpTargetError creates a new DuplicateHelpTargetError.

func (*DuplicateHelpTargetError) Error

func (e *DuplicateHelpTargetError) Error() string

Error implements the error interface.

type MakeExecutionError

type MakeExecutionError struct {
	// Command is the make command that was executed.
	Command string

	// Stderr contains the error output from make.
	Stderr string
}

MakeExecutionError is returned when a make command fails.

func NewMakeExecutionError

func NewMakeExecutionError(command, stderr string) *MakeExecutionError

NewMakeExecutionError creates a new MakeExecutionError.

func (*MakeExecutionError) Error

func (e *MakeExecutionError) Error() string

Error implements the error interface.

type MakefileNotFoundError

type MakefileNotFoundError struct {
	// Path is the path that was searched.
	Path string
}

MakefileNotFoundError is returned when the specified Makefile doesn't exist.

func NewMakefileNotFoundError

func NewMakefileNotFoundError(path string) *MakefileNotFoundError

NewMakefileNotFoundError creates a new MakefileNotFoundError.

func (*MakefileNotFoundError) Error

func (e *MakefileNotFoundError) Error() string

Error implements the error interface.

type MixedCategorizationError

type MixedCategorizationError struct {
	// Message provides additional context about the error.
	Message string
}

MixedCategorizationError is returned when a Makefile contains both categorized and uncategorized targets without --default-category.

func NewMixedCategorizationError

func NewMixedCategorizationError(message string) *MixedCategorizationError

NewMixedCategorizationError creates a new MixedCategorizationError.

func (*MixedCategorizationError) Error

func (e *MixedCategorizationError) Error() string

Error implements the error interface.

type UnknownCategoryError

type UnknownCategoryError struct {
	// CategoryName is the unknown category specified by the user.
	CategoryName string

	// Available lists all valid category names found in the Makefile.
	Available []string
}

UnknownCategoryError is returned when --category-order references a category that doesn't exist in the Makefile.

func NewUnknownCategoryError

func NewUnknownCategoryError(categoryName string, available []string) *UnknownCategoryError

NewUnknownCategoryError creates a new UnknownCategoryError.

func (*UnknownCategoryError) Error

func (e *UnknownCategoryError) Error() string

Error implements the error interface.

type ValidationError

type ValidationError struct {
	// Message describes what validation failed.
	Message string

	// Details provides additional context (e.g., make stderr output).
	Details string
}

ValidationError is returned when Makefile validation fails.

func NewValidationError

func NewValidationError(message, details string) *ValidationError

NewValidationError creates a new ValidationError.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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