Documentation
¶
Overview ¶
Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn Package errors defines an error type for handling deployment errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeploymentError ¶
type DeploymentError struct {
Message string
Cause error
ErrorType string
Context *ValidationContext
}
DeploymentError represents an error that occurred during deployment
func NewDeploymentError ¶
func NewDeploymentError(message string, cause error) *DeploymentError
NewDeploymentError creates a new deployment error
func NewValidationError ¶
func NewValidationError(message string, context *ValidationContext) *DeploymentError
NewValidationError creates a new validation error with structured context
func (*DeploymentError) Error ¶
func (e *DeploymentError) Error() string
Error returns the error message
func (*DeploymentError) Is ¶
func (e *DeploymentError) Is(target error) bool
Is reports whether the target matches this error
func (*DeploymentError) MarshalJSON ¶
func (e *DeploymentError) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface
func (*DeploymentError) Unwrap ¶
func (e *DeploymentError) Unwrap() error
Unwrap returns the underlying error
type Error ¶
type Error struct {
Type ErrorType `json:"type"`
Message string `json:"message"`
Cause error `json:"cause,omitempty"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Stack []string `json:"stack,omitempty"`
}
Error represents a structured error with context
func InternalError ¶
InternalError creates a new internal error
func NetworkError ¶
NetworkError creates a new network error
func SystemError ¶
SystemError creates a new system error
type ErrorType ¶
type ErrorType int
ErrorType represents the category of error
const ( // ErrorTypeUser represents user-caused errors (invalid input, etc.) ErrorTypeUser ErrorType = iota // ErrorTypeSystem represents system-level errors (IO, permissions, etc.) ErrorTypeSystem // ErrorTypeNetwork represents network-related errors ErrorTypeNetwork // ErrorTypeInternal represents internal application errors ErrorTypeInternal )
type ValidationContext ¶
type ValidationContext struct {
Field string `json:"field,omitempty"` // The field that failed validation
ExpectedType string `json:"expected_type,omitempty"` // Expected type/format
ActualValue string `json:"actual_value,omitempty"` // Actual value received
MissingVar string `json:"missing_var,omitempty"` // Name of missing environment variable
AllowedValues []string `json:"allowed_values,omitempty"` // List of allowed values
ResolutionHints []string `json:"resolution_hints,omitempty"` // Hints for fixing the error
Example string `json:"example,omitempty"` // Example of correct usage
}
ValidationContext contains structured information about a validation error