Documentation
¶
Overview ¶
Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package cinzelerror provides structured error types and sentinel errors for the cinzel CLI. It wraps HCL diagnostic errors into standard Go errors and attaches "open issue" guidance to user-facing messages.
Index ¶
Constants ¶
const (
OpenIssue string = "if you think this is incorrect, consider opening an issue in https://www.github.com/yldio/cinzel/issues"
)
OpenIssue is the message appended to errors suggesting users file a bug report.
Variables ¶
var ( ErrWorkflowFilenameRequired = errWorkflowFilenameRequired() ErrOnlyHclFiles = errOnlyHclFiles() ErrOnRestriction = errOnRestriction() ErrSecretsRestriction = errSecretsRestriction() ErrWorkflowEmptyOn = errWorkflowEmptyOn() ErrOpenIssue = errOpenIssue() )
Sentinel errors for workflow and HCL validation.
Functions ¶
func ErrJobEmptySteps ¶
ErrJobEmptySteps returns an error indicating the job has no steps.
func ErrWorkflowEmptyJobs ¶
ErrWorkflowEmptyJobs returns an error indicating the workflow has no jobs.
func ProcessHCLDiags ¶
func ProcessHCLDiags(diags hcl.Diagnostics) error
ProcessHCLDiags converts HCL diagnostics into a single joined error.
A diagnostic's summary stands in when it carries no detail. Only the detail used to be collected, so a summary-only diagnostic left nothing to join and errors.Join returned nil, which the caller printed as "%!w(<nil>)" with the report-an-issue line after it and no sign of what was actually wrong.
func SafeForTerminal ¶ added in v0.6.0
SafeForTerminal rewrites the control characters in s as escaped text.
Errors quote names taken from the input file, and a name is free to carry an ANSI escape sequence. Written to a terminal as they are, those sequences are acted on rather than shown: a crafted job name can recolour the output, erase the line naming the file at fault, or move the cursor to forge a second message. Newline and tab are left alone because the YAML decoder quotes the offending source across several lines, and carriage return is not, because it returns to the start of a line already written.
Only control characters are touched, so a name in any language reads as written.
Types ¶
type Error ¶
type Error struct {
Err error
}
Error wraps an underlying error with additional context and issue-reporting guidance.
func New ¶
New creates an Error from err and optional context messages, appending the OpenIssue text.
func NewFromResource ¶
NewFromResource creates an Error annotated with the resource type and identifier.