command

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 47

Documentation

Index

Constants

View Source
const (
	// Common error group for general command errors.
	Common Group = 1000

	// DIDExchange error group for DID exchange command errors.
	DIDExchange Group = 2000

	// Messaging error group for messaging service errors.
	Messaging Group = 3000

	// VDR error group for VDR command errors.
	VDR Group = 4000

	// ROUTE error group for Route command errors.
	ROUTE Group = 5000

	// VC error group for Verifiable Credential command errors.
	VC Group = 6000

	// KMS error group for key management service errors.
	KMS Group = 7000

	// IssueCredential error group for issue credential command errors.
	IssueCredential = 8000

	// PresentProof error group for present proof command errors.
	PresentProof = 9000

	// Introduce error group for introduce command errors.
	Introduce = 10000

	// Outofband error group for outofband command errors.
	Outofband = 11000

	// OutofbandV2 error group for outofband command errors.
	OutofbandV2 = 11100

	// VCWallet error group for verifiable Credential wallet command errors.
	VCWallet = 12000

	// RFC0593 error group for RFC0593 command errors.
	RFC0593 = 13000

	// LD error group for JSON-LD command errors.
	LD = 14000

	// Connection error group for connection management errors.
	Connection = 15000

	// LegacyConnection error group for legacyconnection command errors.
	LegacyConnection = 16000
)

TODO command types shouldn't be mentioned in common error package, [Issue#1182].

Variables

This section is empty.

Functions

func WriteNillableResponse

func WriteNillableResponse(w io.Writer, v interface{}, l log.Logger)

WriteNillableResponse is a utility function that writes v to w. If v is nil then an empty object is written. TODO this capability should be injected into the command implementations.

Types

type Code

type Code int32

Code is the error code of command errors.

const (
	// UnknownStatus default error code for unknown errors.
	UnknownStatus Code = iota
)

type Error

type Error interface {
	error
	// Code returns error code for this command error.
	Code() Code
	// Type returns error type for this command error.
	Type() Type
}

Error is the interface for representing an command error condition, with the nil value representing no error.

func NewExecuteError

func NewExecuteError(code Code, err error) Error

NewExecuteError returns new command execute error.

func NewValidationError

func NewValidationError(code Code, err error) Error

NewValidationError returns new command validation error.

type Exec

type Exec func(rw io.Writer, req io.Reader) Error

Exec is controller command execution function type.

type Group

type Group int32

Group is the error groups. Note: recommended to use [0-9]*000 pattern for any new entries Example: 2000, 3000, 4000 ...... 25000.

type Handler

type Handler interface {
	// name of the command
	Name() string
	// method name of the command
	Method() string
	// execute function of the command
	Handle() Exec
}

Handler for each controller command.

type MessageHandler

type MessageHandler interface {
	// Services returns list of available message services in this message handler
	Services() []dispatcher.MessageService
	// Register registers given message services to this message handler
	Register(msgSvcs ...dispatcher.MessageService) error
	// Unregister unregisters message service with given name from this message handler
	Unregister(name string) error
}

MessageHandler maintains registered message services and it allows dynamic registration of message services.

type Notifier

type Notifier interface {
	Notify(topic string, message []byte) error
}

Notifier represents a notification dispatcher.

type Type

type Type int32

Type is command error type.

const (
	// ValidationError is error type for command validation errors.
	ValidationError Type = iota

	// ExecuteError is error type for command execution failure.
	ExecuteError Type = iota
)

Jump to

Keyboard shortcuts

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