Taskfile Error Handling Definitions (errors/errors_taskfile.go)

task · errors/errors_taskfile.go · go · MIT
dev-tools, cli, lang:go, tag:task, tag:errors, tag:validation

Defines custom error types for Taskfile operations, including missing files, invalid formats, and security issues. Use this when building tools that interact with Taskfiles to provide consistent error reporting.

// Source: https://github.com/go-task/task | License: MIT | Copyright 2016 Andrey Nering
// Provided via justclaw.it.com; keep this notice with the code.
package errors

import (
	"fmt"
	"net/http"
	"path/filepath"
	"time"

	"github.com/Masterminds/semver/v3"
)

// TaskfileNotFoundError is returned when no appropriate Taskfile is found when
// searching the filesystem.
type TaskfileNotFoundError struct {
	URI         string
	Walk        bool
	AskInit     bool
	OwnerChange bool
}

func (err TaskfileNotFoundError) Error() string {
	var walkText string
	if err.OwnerChange {
		walkText = " (or any of the parent directories until ownership changed)."
	} else if err.Walk {
		walkText = " (or any of the parent directories)."
	}
	if err.AskInit {
		walkText += " Run `task --init` to create a new T

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key