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 ¶
- Variables
- func ErrAuthExpired(cause error) error
- func ErrCloneNetwork(cause error) error
- func ErrLiveReloadBindFailed(port int, cause error) error
- func ErrLocalIO(op string, cause error) error
- func ErrTaskBusinessFailure(task map[string]any) error
- func ErrTaskTimeout(elapsed, cap time.Duration, task map[string]any) error
- func ErrValidation(format string, args ...any) error
- func ErrWatcherFatal(cause error) error
- func RequireThemeID(themeFlag string) (string, error)
- func ValidateThemeID(id string) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
ErrAuthExpired flags an OAuth / 401 / keychain-miss path and suggests `shoplazza auth login`.
func ErrCloneNetwork ¶
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 ¶
ErrLiveReloadBindFailed flags livereload --port conflicts. Network-class because the symptom and remediation mirror a real bind/dial failure.
func ErrLocalIO ¶
ErrLocalIO wraps a local-disk failure (read theme dir, write tmp, disk full). Internal-class — the user can't validate around this.
func ErrTaskBusinessFailure ¶
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 ¶
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 ¶
ErrValidation is a thin theme-package wrapper over output.ErrValidation.
func ErrWatcherFatal ¶
ErrWatcherFatal flags an fsnotify crash (EMFILE / loss / perms revoked). Internal-class because the remediation is an OS-level config change.
func RequireThemeID ¶
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 ¶
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. |