theme

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package theme provides error-classification helpers shared by the theme subpackages and the cmd/themes/* shortcut layer. Every helper maps to exactly one of the five envelope types (api/validation/auth/network/internal).

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingThemeFlag = errors.New("missing required flag --theme-id")

ErrMissingThemeFlag is the sentinel returned (wrapped) by RequireThemeID when the caller did not supply --theme-id. Callers can detect this with errors.Is(err, theme.ErrMissingThemeFlag) without depending on the concrete wrapping error type.

Functions

func ErrAuthExpired

func ErrAuthExpired(cause error) error

ErrAuthExpired flags an OAuth / 401 / keychain-miss path and suggests `shoplazza auth login`.

func ErrCloneNetwork

func ErrCloneNetwork(cause error) error

ErrCloneNetwork is for network-class failures during template clone (DNS, dial, TLS handshake, read timeout, connection reset). Distinct from ErrLocalIO (disk full, permission, archive extraction), which is internal-class.

func ErrLiveReloadBindFailed

func ErrLiveReloadBindFailed(port int, cause error) error

ErrLiveReloadBindFailed flags livereload --port conflicts. Network-class because the symptom and remediation mirror a real bind/dial failure.

func ErrLocalIO

func ErrLocalIO(op string, cause error) error

ErrLocalIO wraps a local-disk failure (read theme dir, write tmp, disk full). Internal-class — the user can't validate around this.

func ErrTaskBusinessFailure

func ErrTaskBusinessFailure(task map[string]any) error

ErrTaskBusinessFailure transports a server-side task=failure into an api-class envelope, passing the whole task payload through under the "task" extra. Uses the task's "message" field verbatim when present.

func ErrTaskTimeout

func ErrTaskTimeout(elapsed, cap time.Duration, task map[string]any) error

ErrTaskTimeout is the task-polling cap. Network-class because the cap protects against an unresponsive remote, not a server rejection. elapsed is the real time spent waiting (rounded to one decimal so test assertions are stable); cap is the configured PollOptions.MaxDuration, interpolated into the message so non-default callers report the truth. The task payload (last observed status) is passed through for triage.

func ErrValidation

func ErrValidation(format string, args ...any) error

ErrValidation is a thin theme-package wrapper over output.ErrValidation.

func ErrWatcherFatal

func ErrWatcherFatal(cause error) error

ErrWatcherFatal flags an fsnotify crash (EMFILE / loss / perms revoked). Internal-class because the remediation is an OS-level config change.

func RequireThemeID

func RequireThemeID(themeFlag string) (string, error)

RequireThemeID enforces the mandatory --theme-id flag with no interactive fallback. When themeFlag is non-empty it is returned verbatim; otherwise a validation-class error is produced that wraps the ErrMissingThemeFlag sentinel and carries the operator-facing hint pointing at `shoplazza themes list`.

This helper is deliberately stdlib-only (plus internal/output) so an import-guard test can prove no TTY / prompt dependency (golang.org/x/term, survey, promptui, bubbletea, huh) leaks in via this path.

func ValidateThemeID

func ValidateThemeID(id string) error

ValidateThemeID rejects --theme-id values containing characters outside [A-Za-z0-9_-]. Empty input is allowed — optional-flag callers (serve, share) handle absence themselves; required-flag callers go through RequireThemeID which validates after the presence check.

Types

This section is empty.

Directories

Path Synopsis
Package devstate persists the per-directory development-theme registry used by `themes serve` when --theme-id is omitted: a map of store host → dev theme id, stored in <theme-dir>/.shoplazza/theme-state.json.
Package devstate persists the per-directory development-theme registry used by `themes serve` when --theme-id is omitted: a map of store host → dev theme id, stored in <theme-dir>/.shoplazza/theme-state.json.

Jump to

Keyboard shortcuts

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