Documentation
¶
Index ¶
- Constants
- type LightShellError
- func FSError(method, code, message string, cause error) *LightShellError
- func HTTPError(method, code, message string, cause error) *LightShellError
- func New(namespace, method, code, message string) *LightShellError
- func PathTraversalError(method, path string, allowedPatterns []string) *LightShellError
- func PermissionError(namespace, method, attempted string, allowed []string, configKey string) *LightShellError
- func PlatformError(namespace, method, platform string) *LightShellError
- func ProcessError(method, code, message string, cause error) *LightShellError
Constants ¶
const ( // Filesystem errors FSNotFound = "FS_NOT_FOUND" FSPermissionDenied = "FS_PERMISSION_DENIED" FSReadError = "FS_READ_ERROR" FSWriteError = "FS_WRITE_ERROR" FSPathTraversal = "FS_PATH_TRAVERSAL" // Permission errors PermissionDenied = "PERMISSION_DENIED" // HTTP errors HTTPTimeout = "HTTP_TIMEOUT" HTTPRequestFailed = "HTTP_REQUEST_FAILED" HTTPDomainDenied = "HTTP_DOMAIN_DENIED" // Process errors ProcessDenied = "PROCESS_DENIED" ProcessTimeout = "PROCESS_TIMEOUT" ProcessFailed = "PROCESS_FAILED" ProcessNotFound = "PROCESS_NOT_FOUND" // Platform errors PlatformUnsupported = "PLATFORM_UNSUPPORTED" // Store errors StoreReadError = "STORE_READ_ERROR" StoreWriteError = "STORE_WRITE_ERROR" // Updater errors UpdaterCheckFailed = "UPDATER_CHECK_FAILED" UpdaterHashMismatch = "UPDATER_HASH_MISMATCH" UpdaterInstallFailed = "UPDATER_INSTALL_FAILED" // Config errors ConfigInvalid = "CONFIG_INVALID" ConfigNotFound = "CONFIG_NOT_FOUND" // Signing errors SigningKeyNotFound = "SIGNING_KEY_NOT_FOUND" SigningFailed = "SIGNING_FAILED" // Release errors ReleaseFailed = "RELEASE_FAILED" UploadFailed = "UPLOAD_FAILED" )
Error codes for LightShell errors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LightShellError ¶
type LightShellError struct {
Namespace string // e.g. "fs", "http", "process"
Method string // e.g. "readFile", "fetch", "exec"
Code string // e.g. FS_NOT_FOUND
Message string // human-readable description
Cause error // underlying error, if any
Fix string // how to fix it
DocsURL string // link to relevant docs
}
LightShellError is a structured error with code, context, and remediation info.
func FSError ¶
func FSError(method, code, message string, cause error) *LightShellError
FSError creates a filesystem error.
func HTTPError ¶
func HTTPError(method, code, message string, cause error) *LightShellError
HTTPError creates an HTTP request error.
func New ¶
func New(namespace, method, code, message string) *LightShellError
New creates a new LightShellError with the given fields.
func PathTraversalError ¶
func PathTraversalError(method, path string, allowedPatterns []string) *LightShellError
PathTraversalError creates a path traversal error with allowed paths listed.
func PermissionError ¶
func PermissionError(namespace, method, attempted string, allowed []string, configKey string) *LightShellError
PermissionError creates a permission denied error with AI-friendly context.
func PlatformError ¶
func PlatformError(namespace, method, platform string) *LightShellError
PlatformError creates a platform unsupported error.
func ProcessError ¶
func ProcessError(method, code, message string, cause error) *LightShellError
ProcessError creates a process execution error.
func (*LightShellError) Error ¶
func (e *LightShellError) Error() string
Error implements the error interface with an AI-debuggable format.
func (*LightShellError) Unwrap ¶
func (e *LightShellError) Unwrap() error
Unwrap returns the underlying cause for errors.Is/As support.
func (*LightShellError) WithCause ¶
func (e *LightShellError) WithCause(cause error) *LightShellError
WithCause sets the underlying cause.
func (*LightShellError) WithDocs ¶
func (e *LightShellError) WithDocs(url string) *LightShellError
WithDocs sets the documentation URL.
func (*LightShellError) WithFix ¶
func (e *LightShellError) WithFix(fix string) *LightShellError
WithFix sets the remediation message.