errdetails

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Error details

Package contains proto representation for details section inside error response.

Proto file defines TargetInfo message which is a default representation of error details that conforms REST API Syntax Specification. It has it's own specific marshal/unmarshal logic.

This functionality should not be directly used in your code. Use WithDetails function from errors package instead.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_github_com_infobloxopen_atlas_app_toolkit_rpc_errdetails_error_details_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type TargetInfo

type TargetInfo struct {

	// The status code is an enumerated error code,
	// which should be an enum value of [google.rpc.Code][google.rpc.Code]
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// The message is a human-readable non-localized message
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// The target is a resource name
	Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

TargetInfo is a default representation of error details that conforms REST API Syntax Specification

func New

func New(c codes.Code, target string, msg string) *TargetInfo

New returns a TargetInfo representing c, target and msg. Converts provided Code to int32

func Newf

func Newf(c codes.Code, target string, format string, a ...interface{}) *TargetInfo

NewfTargetInfo returns NewTargetInfo(c, fmt.Sprintf(format, a...)).

func (*TargetInfo) Descriptor deprecated

func (*TargetInfo) Descriptor() ([]byte, []int)

Deprecated: Use TargetInfo.ProtoReflect.Descriptor instead.

func (*TargetInfo) GetCode

func (x *TargetInfo) GetCode() int32

func (*TargetInfo) GetMessage

func (x *TargetInfo) GetMessage() string

func (*TargetInfo) GetTarget

func (x *TargetInfo) GetTarget() string

func (*TargetInfo) MarshalJSON

func (ti *TargetInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. TargetInfo.Code field is marshaled into string with corresponding value, see [google.rpc.Code][google.rpc.Code], if code is the codes.Unimplemented it is marshaled as "NOT_IMPLEMENTED" string.

func (*TargetInfo) ProtoMessage

func (*TargetInfo) ProtoMessage()

func (*TargetInfo) ProtoReflect

func (x *TargetInfo) ProtoReflect() protoreflect.Message

func (*TargetInfo) Reset

func (x *TargetInfo) Reset()

func (*TargetInfo) String

func (x *TargetInfo) String() string

func (*TargetInfo) UnmarshalJSON

func (ti *TargetInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. If "code" is not provided in JSON data or is null, the TargetInfo.Code will be set to 0 (OK)

Jump to

Keyboard shortcuts

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