errors

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 5 Imported by: 1

README

errors

import "github.com/Azure/iot-operations-sdks/go/protocol/errors"

Index

func Context

func Context(ctx context.Context, msg string) error

Context extracts the timeout or cancellation error from a context.

func Normalize

func Normalize(err error, msg string) error

Normalize well-known errors into protocol errors.

type Error

Error represents a structured protocol error.

type Error struct {
    Message string
    Kind    Kind

    NestedError error

    HeaderName  string
    HeaderValue string

    TimeoutName  string
    TimeoutValue time.Duration

    PropertyName  string
    PropertyValue any

    ProtocolVersion                string
    SupportedMajorProtocolVersions []int

    InApplication  bool
    IsShallow      bool
    IsRemote       bool
    HTTPStatusCode int
}

func (*Error) Error
func (e *Error) Error() string

Error returns the error as a string.

type Kind

Kind defines the type of error being thrown.

type Kind int

The following are the defined error kinds.

const (
    HeaderMissing Kind = iota
    HeaderInvalid
    PayloadInvalid
    Timeout
    Cancellation
    ConfigurationInvalid
    ArgumentInvalid
    StateInvalid
    InternalLogicError
    UnknownError
    InvocationException
    ExecutionException
    MqttError
    UnsupportedRequestVersion
    UnsupportedResponseVersion
)

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context, msg string) error

Context extracts the timeout or cancellation error from a context.

func Normalize

func Normalize(err error, msg string) error

Normalize well-known errors into protocol errors.

Types

type Error

type Error struct {
	Message string
	Kind    Kind

	NestedError error

	HeaderName  string
	HeaderValue string

	TimeoutName  string
	TimeoutValue time.Duration

	PropertyName  string
	PropertyValue any

	ProtocolVersion                string
	SupportedMajorProtocolVersions []int

	InApplication  bool
	IsShallow      bool
	IsRemote       bool
	HTTPStatusCode int
}

Error represents a structured protocol error.

func (*Error) Error

func (e *Error) Error() string

Error returns the error as a string.

type Kind

type Kind int

Kind defines the type of error being thrown.

const (
	HeaderMissing Kind = iota
	HeaderInvalid
	PayloadInvalid
	Timeout
	Cancellation
	ConfigurationInvalid
	ArgumentInvalid
	StateInvalid
	InternalLogicError
	UnknownError
	InvocationException
	ExecutionException
	MqttError
	UnsupportedRequestVersion
	UnsupportedResponseVersion
)

The following are the defined error kinds.

Jump to

Keyboard shortcuts

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