Documentation
¶
Index ¶
- Constants
- type Action
- type AppError
- func Cancelled() *AppError
- func ConfigMissing(setting, detail string) *AppError
- func ConnectionNotFound(pluginID, connectionID string) *AppError
- func Forbidden(title, detail string) *AppError
- func FromResourceOperationError(jsonStr string, pluginID string) *AppError
- func Internal(err error, title string) *AppError
- func New(errType string, status int, title, detail string) *AppError
- func NotFound(title, detail string) *AppError
- func NotImplemented(title, detail string) *AppError
- func PluginAlreadyLoaded(pluginID string) *AppError
- func PluginNotFound(pluginID string) *AppError
- func SessionNotFound(sessionID string) *AppError
- func Wrap(err error, errType string, status int, title string) *AppError
- func WrapWithDetail(err error, errType string, status int, title, detail string) *AppError
Constants ¶
const ( // Plugin errors TypePluginNotFound = "omniview:plugin/not-found" TypePluginNotLoaded = "omniview:plugin/not-loaded" TypePluginAlreadyLoaded = "omniview:plugin/already-loaded" TypePluginInstallFailed = "omniview:plugin/install-failed" TypePluginLoadFailed = "omniview:plugin/load-failed" TypePluginBuildFailed = "omniview:plugin/build-failed" // Settings errors TypeSettingsMissingConfig = "omniview:settings/missing-config" TypeSettingsInvalidConfig = "omniview:settings/invalid-config" // Resource errors TypeResourceNotFound = "omniview:resource/not-found" TypeResourceForbidden = "omniview:resource/forbidden" TypeResourceConflict = "omniview:resource/conflict" TypeResourceTimeout = "omniview:resource/timeout" // Connection errors TypeConnectionNotFound = "omniview:connection/not-found" TypeConnectionFailed = "omniview:connection/failed" // Session errors TypeSessionNotFound = "omniview:session/not-found" TypeSessionFailed = "omniview:session/failed" // General errors TypeCancelled = "omniview:cancelled" TypeInternal = "omniview:internal" TypeValidation = "omniview:validation" TypeNotImplemented = "omniview:not-implemented" )
Error type URI constants used across Go and TypeScript.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Type string `json:"type"` // "navigate", "retry", "open-url", "copy"
Label string `json:"label"`
Target string `json:"target,omitempty"`
}
Action represents a frontend-renderable action button that can be attached to structured errors. The frontend maps each action type to a concrete UI behaviour (navigation, retry, opening a URL, or clipboard copy).
func CopyAction ¶
CopyAction creates an action that copies text to the clipboard.
func NavigateAction ¶
NavigateAction creates an action that navigates to the given in-app route.
func OpenSettingsAction ¶
OpenSettingsAction creates a navigate action to the settings page with the given category.
func OpenURLAction ¶
OpenURLAction creates an action that opens an external URL.
func RetryAction ¶
RetryAction creates an action that signals the frontend to retry the operation.
type AppError ¶
type AppError struct {
Err error `json:"-"`
Type string `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail"`
Instance string `json:"instance,omitempty"`
Suggestions []string `json:"suggestions,omitempty"`
Actions []Action `json:"actions,omitempty"`
}
AppError is a structured error type based on RFC 7807 Problem Details. Its Error() method returns a JSON string so the structured fields survive the Wails IPC boundary (Wails calls .Error() and sends the string to JS).
func Cancelled ¶
func Cancelled() *AppError
Cancelled creates an error for user-cancelled operations.
func ConfigMissing ¶
ConfigMissing creates a 422 error for a missing configuration setting, with an auto-attached "Open Settings" action.
func ConnectionNotFound ¶
ConnectionNotFound creates a structured error for a missing connection.
func FromResourceOperationError ¶
FromResourceOperationError translates a ResourceOperationError JSON string (from the existing plugin-sdk error type) into an AppError.
func NotImplemented ¶
NotImplemented creates a 501 error for features not yet implemented.
func PluginAlreadyLoaded ¶
PluginAlreadyLoaded creates a 409 conflict error for a plugin that is already loaded.
func PluginNotFound ¶
PluginNotFound creates a structured error for a missing plugin.
func SessionNotFound ¶
SessionNotFound creates a structured error for a missing session.
func WrapWithDetail ¶
WrapWithDetail wraps an existing error with a custom detail message.
func (*AppError) Error ¶
Error returns a JSON-encoded representation so the structured fields survive the Wails IPC boundary.
func (*AppError) WithActions ¶
WithActions appends frontend-renderable actions to the error.
func (*AppError) WithInstance ¶
WithInstance sets the instance field (specific occurrence context).
func (*AppError) WithSuggestions ¶
WithSuggestions appends user-facing suggestions to the error.