roborockerrors

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package roborockerrors defines failures shared by the public API and transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Kind      Kind
	Operation string
	Code      int
	Message   string
	Cause     error
}

Error preserves a failure class, operation, vendor code, and underlying cause. Message must not contain credentials or untrusted response bodies.

func New

func New(kind Kind, operation, message string, cause error) *Error

New creates a failure with a caller-safe message and retained cause.

func Wrap

func Wrap(fallback Kind, operation, message string, cause error) *Error

Wrap preserves a typed failure's classification and code with a caller-safe operation. Untyped failures use fallback without exposing the underlying cause in the message.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

Is matches the requested failure kind; empty target kinds do not match.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap exposes the cause for errors.Is and errors.As.

type Kind

type Kind string

Kind is a stable failure class.

const (
	// InvalidArgument indicates an invalid request or option.
	InvalidArgument Kind = "invalid_argument"
	// Unauthorized indicates missing, rejected, or expired credentials.
	Unauthorized Kind = "unauthorized"
	// NotFound indicates a missing account or device.
	NotFound Kind = "not_found"
	// RateLimited indicates vendor throttling.
	RateLimited Kind = "rate_limited"
	// Unavailable indicates a failed connection or unavailable service.
	Unavailable Kind = "unavailable"
	// Timeout indicates that a request deadline elapsed.
	Timeout Kind = "timeout"
	// Canceled indicates caller cancellation.
	Canceled Kind = "canceled"
	// Protocol indicates a malformed response or rejected operation.
	Protocol Kind = "protocol"
	// Closed indicates a closed session.
	Closed Kind = "closed"
	// Unsupported indicates an unsupported protocol or capability.
	Unsupported Kind = "unsupported"
	// Backpressure indicates a full session queue.
	Backpressure Kind = "backpressure"
)

Jump to

Keyboard shortcuts

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