mgmterror

package module
v0.0.0-...-6fcf751 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MPL-2.0 Imports: 9 Imported by: 23

README

Package mgmterror provides the standard NETCONF and YANG errors as defined in RFC6241 and RFC6020 respectively.

Documentation

Overview

Package mgmterror provides the standard NETCONF and YANG errors as defined in RFC6241 and RFC6020 respectively.

While RFC6241 section 4.3 specifies 7 elements of an rpc-error, not all of them are mandatory for a specific error. For example, Path (error-path), will not be present if no appropriate payload element or datastore node can be associated with a particular error condition.

Since the marshal and unmarshal interfaces require the MgmtError structure's members be public, they can be set as needed after an error's constructor is called.

The specifications allow the Info (error-info) field to include additional elements to provide extended and/or implementation-specific debugging information. For example, an error from a low level library can add additional information about the error so that a higher layer can use that information.

Index

Examples

Constants

View Source
const (
	VyattaNamespace = "urn:vyatta.com:mgmt:error:1"
)

Variables

This section is empty.

Functions

func ErrPath

func ErrPath(path []string) string

Types

type AccessDeniedApplicationError

type AccessDeniedApplicationError struct {
	*MgmtError
}

func NewAccessDeniedApplicationError

func NewAccessDeniedApplicationError() *AccessDeniedApplicationError

Application error when access to the requested data model is denied

func (*AccessDeniedApplicationError) MarshalXML

func (e *AccessDeniedApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*AccessDeniedApplicationError) UnmarshalJSON

func (e *AccessDeniedApplicationError) UnmarshalJSON(value []byte) error

type AccessDeniedProtocolError

type AccessDeniedProtocolError struct {
	*MgmtError
}

func NewAccessDeniedProtocolError

func NewAccessDeniedProtocolError() *AccessDeniedProtocolError

Protocol error when access to the requested operation is denied

func (*AccessDeniedProtocolError) MarshalXML

func (e *AccessDeniedProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*AccessDeniedProtocolError) UnmarshalJSON

func (e *AccessDeniedProtocolError) UnmarshalJSON(value []byte) error

type BadAttrApplicationError

type BadAttrApplicationError struct {
	*MgmtError
}

func NewBadAttrApplicationError

func NewBadAttrApplicationError(badAttr, badElem string) *BadAttrApplicationError

Application error when an attribute value is not correct

badAttr is the name of the attribute with bad value badElem is the name of the element that contains the attribute with the bad value

func (*BadAttrApplicationError) MarshalXML

func (e *BadAttrApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*BadAttrApplicationError) UnmarshalJSON

func (e *BadAttrApplicationError) UnmarshalJSON(value []byte) error

type BadAttrProtocolError

type BadAttrProtocolError struct {
	*MgmtError
}

func NewBadAttrProtocolError

func NewBadAttrProtocolError(badAttr, badElem string) *BadAttrProtocolError

Protocol error when an attribute value is not correct

badAttr is the name of the attribute with bad value badElem is the name of the element that contains the attribute with the bad value

func (*BadAttrProtocolError) MarshalXML

func (e *BadAttrProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*BadAttrProtocolError) UnmarshalJSON

func (e *BadAttrProtocolError) UnmarshalJSON(value []byte) error

type BadAttrRpcError

type BadAttrRpcError struct {
	*MgmtError
}

func NewBadAttrRpcError

func NewBadAttrRpcError(badAttr, badElem string) *BadAttrRpcError

Rpc error when an attribute value is not correct

badAttr is the name of the attribute with bad value badElem is the name of the element that contains the attribute with the bad value

func (*BadAttrRpcError) MarshalXML

func (e *BadAttrRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*BadAttrRpcError) UnmarshalJSON

func (e *BadAttrRpcError) UnmarshalJSON(value []byte) error

type BadElementApplicationError

type BadElementApplicationError struct {
	*MgmtError
}

func NewBadElementApplicationError

func NewBadElementApplicationError(badElem string) *BadElementApplicationError

Application error when an element value is not correct

badElem is the name of the element with bad value

func (*BadElementApplicationError) MarshalXML

func (e *BadElementApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*BadElementApplicationError) UnmarshalJSON

func (e *BadElementApplicationError) UnmarshalJSON(value []byte) error

type BadElementProtocolError

type BadElementProtocolError struct {
	*MgmtError
}

func NewBadElementProtocolError

func NewBadElementProtocolError(badElem string) *BadElementProtocolError

Protocol error when an element value is not correct

badElem is the name of the element with bad value

func (*BadElementProtocolError) MarshalXML

func (e *BadElementProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*BadElementProtocolError) UnmarshalJSON

func (e *BadElementProtocolError) UnmarshalJSON(value []byte) error

type DataExistsError

type DataExistsError struct {
	*MgmtError
}

func NewDataExistsError

func NewDataExistsError() *DataExistsError

Application error when the relevant data model content already exists.

func (*DataExistsError) MarshalXML

func (e *DataExistsError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*DataExistsError) UnmarshalJSON

func (e *DataExistsError) UnmarshalJSON(value []byte) error

type DataMissingError

type DataMissingError struct {
	*MgmtError
}

func NewDataMissingError

func NewDataMissingError() *DataMissingError

Application error when the relevent data model content does not exist.

func (*DataMissingError) MarshalXML

func (e *DataMissingError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*DataMissingError) UnmarshalJSON

func (e *DataMissingError) UnmarshalJSON(value []byte) error

type ExecError

type ExecError struct {
	*MgmtError
}
Example
path := []string{"usr", "bin", "app"}
err := NewExecError(path, "core dumped")
fmt.Println(err.Error())
Output:

Error: /usr/bin/app: core dumped

func NewExecError

func NewExecError(path []string, out string) *ExecError

A custom wrapper of a standard "operation failed" to represent an error when executing subtasks.

path is the path of the subtask that was run out is the output of the subtask

func (*ExecError) MarshalXML

func (e *ExecError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*ExecError) UnmarshalJSON

func (e *ExecError) UnmarshalJSON(value []byte) error

type Formattable

type Formattable interface {
	GetMessage() string
	GetPath() string
	GetSeverity() string
	GetTag() string
	GetAppTag() string
	GetType() string
	GetInfo() MgmtErrorInfo
}

Formattable - interface provided by error types to allow formatting (NB: MgmtError is just one example of such a type.)

Unlike plain Go errors, MgmtError types have useful properties which we may wish to print out differently depending on the end user / context. GetMessage() may well be customised for certain error types to include the contents of MgmtError.Info.

type Formatter

type Formatter func(err error) string

type InUseApplicationError

type InUseApplicationError struct {
	*MgmtError
}

func NewInUseApplicationError

func NewInUseApplicationError() *InUseApplicationError

Application error when a resource is already in use.

func (*InUseApplicationError) MarshalXML

func (e *InUseApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InUseApplicationError) UnmarshalJSON

func (e *InUseApplicationError) UnmarshalJSON(value []byte) error

type InUseProtocolError

type InUseProtocolError struct {
	*MgmtError
}

func NewInUseProtocolError

func NewInUseProtocolError() *InUseProtocolError

Protocol error when a resource is already in use.

func (*InUseProtocolError) MarshalXML

func (e *InUseProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InUseProtocolError) UnmarshalJSON

func (e *InUseProtocolError) UnmarshalJSON(value []byte) error

type InsertFailedError

type InsertFailedError struct {
	*MgmtError
}

RFC6020 Sect 13.8 Error Message for the "insert" Operation

func NewInsertFailedError

func NewInsertFailedError() *InsertFailedError

When a NETCONF <edit-config> uses the "insert" and "key" or "value" attributes for a list or leaf-list node, and the "key" or "value" refers to a non-existing instance.

func (*InsertFailedError) MarshalXML

func (e *InsertFailedError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InsertFailedError) UnmarshalJSON

func (e *InsertFailedError) UnmarshalJSON(value []byte) error

type InstanceRequiredError

type InstanceRequiredError struct {
	*MgmtError
}

RFC6020 Sect 13.5 Error Message for Data That Violates a require-instance Statement

func NewInstanceRequiredError

func NewInstanceRequiredError(path string) *InstanceRequiredError

When a NETCONF operation would result in configuration data where a leaf of type "instance-identifier" marked with require-instance "true" refers to a non-existing instance

path is the absolute XPath expression identifying the instance-identifier leaf.

func (*InstanceRequiredError) MarshalXML

func (e *InstanceRequiredError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InstanceRequiredError) UnmarshalJSON

func (e *InstanceRequiredError) UnmarshalJSON(value []byte) error

type InvalidValueApplicationError

type InvalidValueApplicationError struct {
	*MgmtError
}

func NewInvalidValueApplicationError

func NewInvalidValueApplicationError() *InvalidValueApplicationError

Application error when a value for one or more parameters is invalid.

func (*InvalidValueApplicationError) MarshalXML

func (e *InvalidValueApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InvalidValueApplicationError) UnmarshalJSON

func (e *InvalidValueApplicationError) UnmarshalJSON(value []byte) error

type InvalidValueProtocolError

type InvalidValueProtocolError struct {
	*MgmtError
}

func NewInvalidValueProtocolError

func NewInvalidValueProtocolError() *InvalidValueProtocolError

Protocol error when a value for one or more parameters is invalid.

func (*InvalidValueProtocolError) MarshalXML

func (e *InvalidValueProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*InvalidValueProtocolError) UnmarshalJSON

func (e *InvalidValueProtocolError) UnmarshalJSON(value []byte) error

type LeafrefMismatchError

type LeafrefMismatchError struct {
	*MgmtError
}

RFC6020 Sect 13.6 Error Message for Data That Does Not Match a leafref Type

func NewLeafrefMismatchError

func NewLeafrefMismatchError(path, lrefPath string) *LeafrefMismatchError

When a NETCONF operation would result in configuration data where a leaf of type "leafref" refers to a non-existing instance

path is the absolute XPath expression identifying the leafref leaf.

func (*LeafrefMismatchError) MarshalXML

func (e *LeafrefMismatchError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*LeafrefMismatchError) UnmarshalJSON

func (e *LeafrefMismatchError) UnmarshalJSON(value []byte) error

type LockDeniedError

type LockDeniedError struct {
	*MgmtError
}

func NewLockDeniedError

func NewLockDeniedError(sess string) *LockDeniedError

Protocol error when access to the requested lock is denied

sess is the session id that currently holds the lock or zero when a non-NETCONF entity holds the lock.

func (*LockDeniedError) MarshalXML

func (e *LockDeniedError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*LockDeniedError) UnmarshalJSON

func (e *LockDeniedError) UnmarshalJSON(value []byte) error

type MalformedMessageError

type MalformedMessageError struct {
	*MgmtError
}

func NewMalformedMessageError

func NewMalformedMessageError() *MalformedMessageError

Rpc error when a message could not be handled because it failed to be parsed correctly.

This error is new in :base:1.1 and MUST NOT be sent to old clients.

func (*MalformedMessageError) MarshalXML

func (e *MalformedMessageError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MalformedMessageError) UnmarshalJSON

func (e *MalformedMessageError) UnmarshalJSON(value []byte) error

type MgmtError

type MgmtError struct {
	XMLName xml.Name `json:"-"`

	// Typ is the type of error
	//
	// RFC6241 Sect 4.3 defines four types of errors:
	//  - transport (layer: Secure Transport)
	//  - rpc (layer: Messages)
	//  - protocol (layer: Operations)
	//  - application (layer: Content)
	Typ string `xml:"error-type" json:"error-type"`

	// Tag identifies the error condition
	//
	// Allowed values for NETCONF and YANG tags are defined by
	// RFC6241 Appendix A and RFC6020 Section 13 respectively.
	Tag string `xml:"error-tag" json:"error-tag"`

	// Severity indicates the error severity
	//
	// RFC6241 Sect 4.3 defines two of error severities:
	//  - error
	//  - warning
	Severity string `xml:"error-severity" json:"error-severity"`

	// AppTag identifies the data-model-specific or
	// implementation-specific error condition, if one exists.
	AppTag string `xml:"error-app-tag,omitempty" json:"error-app-tag,omitempty"`

	// Path contains the absolute XPath expression identifying the
	// element path to the node that is associated with the error
	// being reported if an appropriate payload element or
	// datastore node can be associated with a particular error
	// condition.
	//
	// See RFC6241 Section 4.3 for details on the context for the
	// XPath expression.
	Path string `xml:"error-path,omitempty" json:"error-path,omitempty"`

	// Message contains a string suitable for human display that
	// describes the error condition.
	Message string `xml:"error-message,omitempty" json:"error-message,omitempty"`

	// Info contains protocol- or data-model-specific error
	// content. This element will not be present if no such error
	// content is provided for a particular error condition. An
	// implementation MAY include additional elements to provide
	// extended and/or implementation- specific debugging
	// information.
	Info MgmtErrorInfo `xml:"error-info,omitempty" json:"error-info,omitempty"`
}

Error structure based on RFC6241 Sect 4.3.

func (*MgmtError) DBusError

func (e *MgmtError) DBusError() (string, []interface{})

Encode error for DBus

func (MgmtError) Error

func (e MgmtError) Error() string

func (*MgmtError) GetAppTag

func (me *MgmtError) GetAppTag() string

func (*MgmtError) GetInfo

func (me *MgmtError) GetInfo() MgmtErrorInfo

func (*MgmtError) GetMessage

func (me *MgmtError) GetMessage() string

func (*MgmtError) GetPath

func (me *MgmtError) GetPath() string

func (*MgmtError) GetSeverity

func (me *MgmtError) GetSeverity() string

func (*MgmtError) GetTag

func (me *MgmtError) GetTag() string

func (*MgmtError) GetType

func (me *MgmtError) GetType() string

type MgmtErrorInfo

type MgmtErrorInfo []MgmtErrorInfoTag

func (MgmtErrorInfo) FindMgmtErrorTag

func (e MgmtErrorInfo) FindMgmtErrorTag(ns, name string) string

func (*MgmtErrorInfo) MarshalXML

func (e *MgmtErrorInfo) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MgmtErrorInfo) UnmarshalXML

func (e *MgmtErrorInfo) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type MgmtErrorInfoTag

type MgmtErrorInfoTag struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
}

MgmtErrorInfoTag holds additional information for an error.

Some NETCONF and YANG defined errors have mandatory InfoTag information. Implementations may include additional elements to provide extended and/or implementation- specific debugging information.

func NewMgmtErrorInfoTag

func NewMgmtErrorInfoTag(ns, name, value string) *MgmtErrorInfoTag

func (*MgmtErrorInfoTag) MarshalJSON

func (i *MgmtErrorInfoTag) MarshalJSON() ([]byte, error)

func (*MgmtErrorInfoTag) UnmarshalJSON

func (i *MgmtErrorInfoTag) UnmarshalJSON(value []byte) error

type MgmtErrorList

type MgmtErrorList struct {
	// contains filtered or unexported fields
}
Example
var n uint
gen := func() *testMgmtError {
	n++
	return genTestMgmtError(n)
}
var elist MgmtErrorList
elist.MgmtErrorListAppend(gen(),
	gen(),
	gen(),
	gen(),
	fmt.Errorf("This is not a MgmtError error"))

fmt.Println(elist.Error())
Output:

Error: /path/1: Message 1
Error: /path/2: Message 2
Error: /path/3: Message 3
Error: /path/4: Message 4
Error: This is not a MgmtError error
Example (CustomFormat)

All errors are mgmterror, though may not have path set. Here we check that the ones w/o path are processed correctly by custom format function. Also need to check override to GetMessage / GetPath works TBD

var n uint
gen := func() *testMgmtError {
	n++
	return genTestMgmtError(n)
}
var elist MgmtErrorList
elist.MgmtErrorListAppend(gen(),
	gen(),
	fmt.Errorf("This is not a MgmtError error"))

fmt.Println(elist.CustomError(formatCommitFailErrors))
Output:

[path 1]

Message 1

[[path 1]] failed.
[path 2]

Message 2

[[path 2]] failed.
[]

This is not a MgmtError error

[[]] failed.

func (MgmtErrorList) CustomError

func (e MgmtErrorList) CustomError(fmtFn Formatter) string

func (*MgmtErrorList) DBusError

func (e *MgmtErrorList) DBusError() (string, []interface{})

Encode error for DBus

func (MgmtErrorList) Error

func (e MgmtErrorList) Error() string

func (MgmtErrorList) Errors

func (e MgmtErrorList) Errors() []error

func (MgmtErrorList) MarshalJSON

func (e MgmtErrorList) MarshalJSON() ([]byte, error)

func (MgmtErrorList) MarshalXML

func (e MgmtErrorList) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MgmtErrorList) MgmtErrorListAppend

func (e *MgmtErrorList) MgmtErrorListAppend(errs ...error)

func (*MgmtErrorList) UnmarshalJSON

func (e *MgmtErrorList) UnmarshalJSON(value []byte) error

type MgmtErrorRef

type MgmtErrorRef interface {
	// contains filtered or unexported methods
}

MgmtErrorRef - interface that allows us to identify all types of MgmtError in a single check. Use of private function (mgmtErrorRef) ensures no one else can create an object that meets the interface unless it explicitly includes a MgmtError object, in which case that's ok.

type MissingAttrApplicationError

type MissingAttrApplicationError struct {
	*MgmtError
}

func NewMissingAttrApplicationError

func NewMissingAttrApplicationError(badAttr, badElem string) *MissingAttrApplicationError

Application error when an expected attribute is missing

badAttr is the name of the missing attribute badElem is the name of the element that is supposed to contain the missing attribute

func (*MissingAttrApplicationError) MarshalXML

func (e *MissingAttrApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingAttrApplicationError) UnmarshalJSON

func (e *MissingAttrApplicationError) UnmarshalJSON(value []byte) error

type MissingAttrProtocolError

type MissingAttrProtocolError struct {
	*MgmtError
}

func NewMissingAttrProtocolError

func NewMissingAttrProtocolError(badAttr, badElem string) *MissingAttrProtocolError

Protocol error when an expected attribute is missing

badAttr is the name of the missing attribute badElem is the name of the element that is supposed to contain the missing attribute

func (*MissingAttrProtocolError) MarshalXML

func (e *MissingAttrProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingAttrProtocolError) UnmarshalJSON

func (e *MissingAttrProtocolError) UnmarshalJSON(value []byte) error

type MissingAttrRpcError

type MissingAttrRpcError struct {
	*MgmtError
}

func NewMissingAttrRpcError

func NewMissingAttrRpcError(badAttr, badElem string) *MissingAttrRpcError

Rpc error when an expected attribute is missing

badAttr is the name of the missing attribute badElem is the name of the element that is supposed to contain the missing attribute

func (*MissingAttrRpcError) MarshalXML

func (e *MissingAttrRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingAttrRpcError) UnmarshalJSON

func (e *MissingAttrRpcError) UnmarshalJSON(value []byte) error

type MissingChoiceError

type MissingChoiceError struct {
	*MgmtError
}

RFC6020 Sect 13.7 Error Message for Data That Violates a mandatory choice Statement

func NewMissingChoiceError

func NewMissingChoiceError(path, name string) *MissingChoiceError

When a NETCONF operation would result in configuration data where no nodes exists in a mandatory choice

path is the absolute XPath expression identifying the element with the missing choice. name is the missing mandatory choice

func (*MissingChoiceError) MarshalXML

func (e *MissingChoiceError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingChoiceError) UnmarshalJSON

func (e *MissingChoiceError) UnmarshalJSON(value []byte) error

type MissingElementApplicationError

type MissingElementApplicationError struct {
	*MgmtError
}

func NewMissingElementApplicationError

func NewMissingElementApplicationError(badElem string) *MissingElementApplicationError

Application error when an expected element is missing

badElem is the name of the missing element

func (*MissingElementApplicationError) Error

func (*MissingElementApplicationError) MarshalXML

func (e *MissingElementApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingElementApplicationError) UnmarshalJSON

func (e *MissingElementApplicationError) UnmarshalJSON(value []byte) error

type MissingElementProtocolError

type MissingElementProtocolError struct {
	*MgmtError
}

func NewMissingElementProtocolError

func NewMissingElementProtocolError(badElem string) *MissingElementProtocolError

Protocol error when an expected element is missing

badElem is the name of the missing element

func (*MissingElementProtocolError) Error

func (*MissingElementProtocolError) MarshalXML

func (e *MissingElementProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MissingElementProtocolError) UnmarshalJSON

func (e *MissingElementProtocolError) UnmarshalJSON(value []byte) error

type MustViolationError

type MustViolationError struct {
	*MgmtError
}

RFC6020 Sect 13.4 Error Message for Data That Violates a must Statement

func NewMustViolationError

func NewMustViolationError() *MustViolationError

When a NETCONF operation would result in configuration data where the restrictions imposed by a "must" statement is violated

func (*MustViolationError) MarshalXML

func (e *MustViolationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*MustViolationError) UnmarshalJSON

func (e *MustViolationError) UnmarshalJSON(value []byte) error

type NonUniqueError

type NonUniqueError struct {
	*MgmtError
}

RFC6020 Sect 13.1 Error Message for Data That Violates a unique Statement

Example
basepath := "/testcontainer/testlist"
paths := []string{
	basepath + "/name/dev1/attr/value",
	basepath + "/name/dev2/attr/value",
	basepath + "/name/dev3/attr/value",
}
err := NewNonUniqueError(paths)
err.Path = basepath
fmt.Println(err.Error())
Output:

Error: /testcontainer/testlist: Non-unique paths name/dev1/attr/value, name/dev2/attr/value, name/dev3/attr/value

func NewNonUniqueError

func NewNonUniqueError(paths []string) *NonUniqueError

When a NETCONF operation would result in configuration data where a unique constraint is invalidated.

paths are a set of instance identifiers that points to a leaf that invalidates the unique constraint. This element is present once for each non-unique leaf.

func (*NonUniqueError) Error

func (e *NonUniqueError) Error() string

func (*NonUniqueError) MarshalXML

func (e *NonUniqueError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*NonUniqueError) UnmarshalJSON

func (e *NonUniqueError) UnmarshalJSON(value []byte) error

type OperationFailedApplicationError

type OperationFailedApplicationError struct {
	*MgmtError
}
Example
err := NewOperationFailedApplicationError()
err.Path = "/foo/bar"
fmt.Println(err.Error())
Output:

Error: /foo/bar: Request could not be completed because the requested operation failed for some reason not covered by any other error condition.

func NewOperationFailedApplicationError

func NewOperationFailedApplicationError() *OperationFailedApplicationError

Application error when the request could not be completed because the requested operation failed for some reason not covered by any other error condition.

func (*OperationFailedApplicationError) MarshalXML

func (e *OperationFailedApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*OperationFailedApplicationError) UnmarshalJSON

func (e *OperationFailedApplicationError) UnmarshalJSON(value []byte) error

type OperationFailedProtocolError

type OperationFailedProtocolError struct {
	*MgmtError
}

func NewOperationFailedProtocolError

func NewOperationFailedProtocolError() *OperationFailedProtocolError

Protocol error when the request could not be completed because the requested operation failed for some reason not covered by any other error condition.

func (*OperationFailedProtocolError) MarshalXML

func (e *OperationFailedProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*OperationFailedProtocolError) UnmarshalJSON

func (e *OperationFailedProtocolError) UnmarshalJSON(value []byte) error

type OperationFailedRpcError

type OperationFailedRpcError struct {
	*MgmtError
}

func NewOperationFailedRpcError

func NewOperationFailedRpcError() *OperationFailedRpcError

Rpc error when the request could not be completed because the requested operation failed for some reason not covered by any other error condition.

func (*OperationFailedRpcError) MarshalXML

func (e *OperationFailedRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*OperationFailedRpcError) UnmarshalJSON

func (e *OperationFailedRpcError) UnmarshalJSON(value []byte) error

type OperationNotSupportedApplicationError

type OperationNotSupportedApplicationError struct {
	*MgmtError
}

func NewOperationNotSupportedApplicationError

func NewOperationNotSupportedApplicationError() *OperationNotSupportedApplicationError

Application error when the requested operation is not supported by this implementation.

func (*OperationNotSupportedApplicationError) MarshalXML

func (*OperationNotSupportedApplicationError) UnmarshalJSON

func (e *OperationNotSupportedApplicationError) UnmarshalJSON(value []byte) error

type OperationNotSupportedProtocolError

type OperationNotSupportedProtocolError struct {
	*MgmtError
}

func NewOperationNotSupportedProtocolError

func NewOperationNotSupportedProtocolError() *OperationNotSupportedProtocolError

Protocol error when the requested operation is not supported by this implementation.

func (*OperationNotSupportedProtocolError) MarshalXML

func (*OperationNotSupportedProtocolError) UnmarshalJSON

func (e *OperationNotSupportedProtocolError) UnmarshalJSON(value []byte) error

type PathAmbiguousError

type PathAmbiguousError struct {
	*MgmtError
}
Example
path := []string{"s"}
matches := map[string]string{
	"system":   "System parameters",
	"service":  "Services",
	"security": "Security",
}
err := NewPathAmbiguousError(path, matches)
fmt.Println(err.Error())
Output:

Error: /s: Ambiguous path, could be one of: security, service, system
Example (Command)
matches := map[string]string{
	"show": "Show the configuration (default values may be suppressed)",
	"set":  "Set the value of a parameter or create a new element",
	"save": "Save configuration to a file",
}
err := NewPathAmbiguousError([]string{}, matches)
fmt.Println(err.Error())
Output:

Error: Ambiguous command, could be one of: save, set, show

func NewPathAmbiguousError

func NewPathAmbiguousError(path []string, matches map[string]string) *PathAmbiguousError

A custom wrapper of a standard "operation failed" to represent an error when a path is ambiguous

path is the path that was ambiguous matches are the possible completions for path

func (*PathAmbiguousError) Error

func (e *PathAmbiguousError) Error() string

func (*PathAmbiguousError) GetMessage

func (e *PathAmbiguousError) GetMessage() string

func (*PathAmbiguousError) MarshalXML

func (e *PathAmbiguousError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*PathAmbiguousError) UnmarshalJSON

func (e *PathAmbiguousError) UnmarshalJSON(value []byte) error

type ResourceDeniedApplicationError

type ResourceDeniedApplicationError struct {
	*MgmtError
}

func NewResourceDeniedApplicationError

func NewResourceDeniedApplicationError() *ResourceDeniedApplicationError

Application error when request could not be completed because of insufficient resources.

func (*ResourceDeniedApplicationError) MarshalXML

func (e *ResourceDeniedApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*ResourceDeniedApplicationError) UnmarshalJSON

func (e *ResourceDeniedApplicationError) UnmarshalJSON(value []byte) error

type ResourceDeniedProtocolError

type ResourceDeniedProtocolError struct {
	*MgmtError
}

func NewResourceDeniedProtocolError

func NewResourceDeniedProtocolError() *ResourceDeniedProtocolError

Protocol error when request could not be completed because of insufficient resources.

func (*ResourceDeniedProtocolError) MarshalXML

func (e *ResourceDeniedProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*ResourceDeniedProtocolError) UnmarshalJSON

func (e *ResourceDeniedProtocolError) UnmarshalJSON(value []byte) error

type ResourceDeniedRpcError

type ResourceDeniedRpcError struct {
	*MgmtError
}

func NewResourceDeniedRpcError

func NewResourceDeniedRpcError() *ResourceDeniedRpcError

Rpc error when request could not be completed because of insufficient resources.

func (*ResourceDeniedRpcError) MarshalXML

func (e *ResourceDeniedRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*ResourceDeniedRpcError) UnmarshalJSON

func (e *ResourceDeniedRpcError) UnmarshalJSON(value []byte) error

type ResourceDeniedTransportError

type ResourceDeniedTransportError struct {
	*MgmtError
}

func NewResourceDeniedTransportError

func NewResourceDeniedTransportError() *ResourceDeniedTransportError

Transport error when request could not be completed because of insufficient resources.

func (*ResourceDeniedTransportError) MarshalXML

func (e *ResourceDeniedTransportError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*ResourceDeniedTransportError) UnmarshalJSON

func (e *ResourceDeniedTransportError) UnmarshalJSON(value []byte) error

type RollbackFailedApplicationError

type RollbackFailedApplicationError struct {
	*MgmtError
}

func NewRollbackFailedApplicationError

func NewRollbackFailedApplicationError() *RollbackFailedApplicationError

Application error when request to roll back some configuration change (via rollback-on-error or <discard-changes> operations) was not completed.

func (*RollbackFailedApplicationError) MarshalXML

func (e *RollbackFailedApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*RollbackFailedApplicationError) UnmarshalJSON

func (e *RollbackFailedApplicationError) UnmarshalJSON(value []byte) error

type RollbackFailedProtocolError

type RollbackFailedProtocolError struct {
	*MgmtError
}

func NewRollbackFailedProtocolError

func NewRollbackFailedProtocolError() *RollbackFailedProtocolError

Protocol error when request to roll back some configuration change (via rollback-on-error or <discard-changes> operations) was not completed.

func (*RollbackFailedProtocolError) MarshalXML

func (e *RollbackFailedProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*RollbackFailedProtocolError) UnmarshalJSON

func (e *RollbackFailedProtocolError) UnmarshalJSON(value []byte) error

type TooBigApplicationError

type TooBigApplicationError struct {
	*MgmtError
}

func NewTooBigApplicationError

func NewTooBigApplicationError() *TooBigApplicationError

Application error when request or response (that would be generated) is too large for the implementation to handle.

func (*TooBigApplicationError) MarshalXML

func (e *TooBigApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooBigApplicationError) UnmarshalJSON

func (e *TooBigApplicationError) UnmarshalJSON(value []byte) error

type TooBigProtocolError

type TooBigProtocolError struct {
	*MgmtError
}

func NewTooBigProtocolError

func NewTooBigProtocolError() *TooBigProtocolError

Protocol error when request or response (that would be generated) is too large for the implementation to handle.

func (*TooBigProtocolError) MarshalXML

func (e *TooBigProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooBigProtocolError) UnmarshalJSON

func (e *TooBigProtocolError) UnmarshalJSON(value []byte) error

type TooBigRpcError

type TooBigRpcError struct {
	*MgmtError
}

func NewTooBigRpcError

func NewTooBigRpcError() *TooBigRpcError

Rpc error when request or response (that would be generated) is too large for the implementation to handle.

func (*TooBigRpcError) MarshalXML

func (e *TooBigRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooBigRpcError) UnmarshalJSON

func (e *TooBigRpcError) UnmarshalJSON(value []byte) error

type TooBigTransportError

type TooBigTransportError struct {
	*MgmtError
}

func NewTooBigTransportError

func NewTooBigTransportError() *TooBigTransportError

Transport error when request or response (that would be generated) is too large for the implementation to handle.

func (*TooBigTransportError) MarshalXML

func (e *TooBigTransportError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooBigTransportError) UnmarshalJSON

func (e *TooBigTransportError) UnmarshalJSON(value []byte) error

type TooFewElementsError

type TooFewElementsError struct {
	*MgmtError
}

RFC6020 Sect 13.3 Error Message for Data That Violates a min-elements Statement

func NewTooFewElementsError

func NewTooFewElementsError(path string) *TooFewElementsError

When a NETCONF operation would result in configuration data where a list or a leaf-list would have too few entries. This error should only be returned once even if there are more than one child missing.

path is the absolute XPath expression identifying the list node

func (*TooFewElementsError) MarshalXML

func (e *TooFewElementsError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooFewElementsError) UnmarshalJSON

func (e *TooFewElementsError) UnmarshalJSON(value []byte) error

type TooManyElementsError

type TooManyElementsError struct {
	*MgmtError
}

RFC6020 Sect 13.2 Error Message for Data That Violates a max-elements Statement

Example
err := NewTooManyElementsError("biz")
err.Path = "/foo/bar"
fmt.Println(err.Error())
Output:

Error: /foo/bar: The requested operation failed.

func NewTooManyElementsError

func NewTooManyElementsError(path string) *TooManyElementsError

When a NETCONF operation would result in configuration data where a list or a leaf-list would have too many entries. This error should only be returned once even if there are more than one extra child present.

path is the absolute XPath expression identifying the list node

func (*TooManyElementsError) MarshalXML

func (e *TooManyElementsError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*TooManyElementsError) UnmarshalJSON

func (e *TooManyElementsError) UnmarshalJSON(value []byte) error

type UnknownAttrApplicationError

type UnknownAttrApplicationError struct {
	*MgmtError
}

func NewUnknownAttrApplicationError

func NewUnknownAttrApplicationError(badAttr, badElem string) *UnknownAttrApplicationError

Application error when an unexpected attribute is present

badAttr is the name of the unexpected attribute badElem is the name of the element that contains the unexpected attribute

func (*UnknownAttrApplicationError) MarshalXML

func (e *UnknownAttrApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownAttrApplicationError) UnmarshalJSON

func (e *UnknownAttrApplicationError) UnmarshalJSON(value []byte) error

type UnknownAttrProtocolError

type UnknownAttrProtocolError struct {
	*MgmtError
}

func NewUnknownAttrProtocolError

func NewUnknownAttrProtocolError(badAttr, badElem string) *UnknownAttrProtocolError

Protocol error when an unexpected attribute is present

badAttr is the name of the unexpected attribute badElem is the name of the element that contains the unexpected attribute

func (*UnknownAttrProtocolError) MarshalXML

func (e *UnknownAttrProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownAttrProtocolError) UnmarshalJSON

func (e *UnknownAttrProtocolError) UnmarshalJSON(value []byte) error

type UnknownAttrRpcError

type UnknownAttrRpcError struct {
	*MgmtError
}

func NewUnknownAttrRpcError

func NewUnknownAttrRpcError(badAttr, badElem string) *UnknownAttrRpcError

Rpc error when an unexpected attribute is present

badAttr is the name of the unexpected attribute badElem is the name of the element that contains the unexpected attribute

func (*UnknownAttrRpcError) MarshalXML

func (e *UnknownAttrRpcError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownAttrRpcError) UnmarshalJSON

func (e *UnknownAttrRpcError) UnmarshalJSON(value []byte) error

type UnknownElementApplicationError

type UnknownElementApplicationError struct {
	*MgmtError
}
Example
err := NewUnknownElementApplicationError("biz")
err.Path = "/foo/bar"
fmt.Println(err.Error())
Output:

func NewUnknownElementApplicationError

func NewUnknownElementApplicationError(badElem string) *UnknownElementApplicationError

Application error when an unexpected element is present

badElem is the name of the unexpected element

func (*UnknownElementApplicationError) Error

func (*UnknownElementApplicationError) GetMessage

func (ueae *UnknownElementApplicationError) GetMessage() string

func (*UnknownElementApplicationError) MarshalXML

func (e *UnknownElementApplicationError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownElementApplicationError) UnmarshalJSON

func (e *UnknownElementApplicationError) UnmarshalJSON(value []byte) error

type UnknownElementProtocolError

type UnknownElementProtocolError struct {
	*MgmtError
}

func NewUnknownElementProtocolError

func NewUnknownElementProtocolError(badElem string) *UnknownElementProtocolError

Protocol error when an unexpected element is present

badElem is the name of the unexpected element

func (*UnknownElementProtocolError) Error

func (*UnknownElementProtocolError) GetMessage

func (uepe *UnknownElementProtocolError) GetMessage() string

func (*UnknownElementProtocolError) MarshalXML

func (e *UnknownElementProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownElementProtocolError) UnmarshalJSON

func (e *UnknownElementProtocolError) UnmarshalJSON(value []byte) error

type UnknownNamespaceApplicationError

type UnknownNamespaceApplicationError struct {
	*MgmtError
}

func NewUnknownNamespaceApplicationError

func NewUnknownNamespaceApplicationError(badElem, badNS string) *UnknownNamespaceApplicationError

Application error when an unexpected namespace is present

badElem is the name of the element that contains the unexpected namespace badNS is the name of the unexpected namespace

func (*UnknownNamespaceApplicationError) MarshalXML

func (*UnknownNamespaceApplicationError) UnmarshalJSON

func (e *UnknownNamespaceApplicationError) UnmarshalJSON(value []byte) error

type UnknownNamespaceProtocolError

type UnknownNamespaceProtocolError struct {
	*MgmtError
}

func NewUnknownNamespaceProtocolError

func NewUnknownNamespaceProtocolError(badElem, badNS string) *UnknownNamespaceProtocolError

Protocol error when an unexpected namespace is present

badElem is the name of the element that contains the unexpected namespace badNS is the name of the unexpected namespace

func (*UnknownNamespaceProtocolError) MarshalXML

func (e *UnknownNamespaceProtocolError) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*UnknownNamespaceProtocolError) UnmarshalJSON

func (e *UnknownNamespaceProtocolError) UnmarshalJSON(value []byte) error

type YangError

type YangError struct {
	*MgmtError
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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