errcode

package
v2.468.8 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0, MIT Imports: 10 Imported by: 5

Documentation

Overview

Package errcode contains the list of Berty error codes.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthErrcode        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrcode          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupErrcode = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrCode_name = map[int32]string{}/* 103 elements not displayed */
View Source
var ErrCode_value = map[string]int32{}/* 103 elements not displayed */

Functions

func Has added in v2.115.0

func Has(err error, code WithCode) bool

Has returns true if one of the error is or contains (wraps) an expected errcode

func Is added in v2.115.0

func Is(err error, code WithCode) bool

Is returns true if the top-level error (not the FirstCode) is actually an ErrCode of the same value

Types

type ErrCode

type ErrCode int32
const (
	Undefined                      ErrCode = 0
	TODO                           ErrCode = 666
	ErrNotImplemented              ErrCode = 777
	ErrInternal                    ErrCode = 888
	ErrInvalidInput                ErrCode = 100
	ErrInvalidRange                ErrCode = 101
	ErrMissingInput                ErrCode = 102
	ErrSerialization               ErrCode = 103
	ErrDeserialization             ErrCode = 104
	ErrStreamRead                  ErrCode = 105
	ErrStreamWrite                 ErrCode = 106
	ErrStreamTransform             ErrCode = 110
	ErrStreamSendAndClose          ErrCode = 111
	ErrStreamHeaderWrite           ErrCode = 112
	ErrStreamHeaderRead            ErrCode = 115
	ErrStreamSink                  ErrCode = 113
	ErrStreamCloseAndRecv          ErrCode = 114
	ErrMissingMapKey               ErrCode = 107
	ErrDBWrite                     ErrCode = 108
	ErrDBRead                      ErrCode = 109
	ErrDBDestroy                   ErrCode = 120
	ErrDBMigrate                   ErrCode = 121
	ErrDBReplay                    ErrCode = 122
	ErrDBRestore                   ErrCode = 123
	ErrDBOpen                      ErrCode = 124
	ErrDBClose                     ErrCode = 125
	ErrCryptoRandomGeneration      ErrCode = 200
	ErrCryptoKeyGeneration         ErrCode = 201
	ErrCryptoNonceGeneration       ErrCode = 202
	ErrCryptoSignature             ErrCode = 203
	ErrCryptoSignatureVerification ErrCode = 204
	ErrCryptoDecrypt               ErrCode = 205
	ErrCryptoDecryptPayload        ErrCode = 206
	ErrCryptoEncrypt               ErrCode = 207
	ErrCryptoKeyConversion         ErrCode = 208
	ErrCryptoCipherInit            ErrCode = 209
	ErrCryptoKeyDerivation         ErrCode = 210
	ErrMap                         ErrCode = 300
	ErrForEach                     ErrCode = 301
	ErrKeystoreGet                 ErrCode = 400
	ErrKeystorePut                 ErrCode = 401
	ErrNotFound                    ErrCode = 404
	ErrIPFSAdd                     ErrCode = 1050
	ErrIPFSGet                     ErrCode = 1051
	ErrIPFSInit                    ErrCode = 1052
	ErrIPFSSetupConfig             ErrCode = 1053
	ErrIPFSSetupRepo               ErrCode = 1054
	ErrIPFSSetupHost               ErrCode = 1055
	// Event errors
	ErrEventListMetadata                   ErrCode = 1400
	ErrEventListMessage                    ErrCode = 1401
	ErrBridgeInterrupted                   ErrCode = 1600
	ErrBridgeNotRunning                    ErrCode = 1601
	ErrMessengerInvalidDeepLink            ErrCode = 2000
	ErrMessengerDeepLinkRequiresPassphrase ErrCode = 2001
	ErrMessengerDeepLinkInvalidPassphrase  ErrCode = 2002
	ErrMessengerStreamEvent                ErrCode = 2003
	ErrMessengerContactMetadataUnmarshal   ErrCode = 2004
	ErrDBEntryAlreadyExists                ErrCode = 2100
	ErrDBAddConversation                   ErrCode = 2101
	ErrDBAddContactRequestOutgoingSent     ErrCode = 2102
	ErrDBAddContactRequestOutgoingEnqueud  ErrCode = 2103
	ErrDBAddContactRequestIncomingReceived ErrCode = 2104
	ErrDBAddContactRequestIncomingAccepted ErrCode = 2105
	ErrDBAddGroupMemberDeviceAdded         ErrCode = 2106
	ErrDBMultipleRecords                   ErrCode = 2107
	ErrReplayProcessGroupMetadata          ErrCode = 2200
	ErrReplayProcessGroupMessage           ErrCode = 2201
	ErrAttachmentPrepare                   ErrCode = 2300
	ErrAttachmentRetrieve                  ErrCode = 2301
	ErrProtocolSend                        ErrCode = 2302
	ErrProtocolEventUnmarshal              ErrCode = 2303
	ErrProtocolGetGroupInfo                ErrCode = 2304
	// Test Error
	ErrTestEcho                                          ErrCode = 2401
	ErrTestEchoRecv                                      ErrCode = 2402
	ErrTestEchoSend                                      ErrCode = 2403
	ErrCLINoTermcaps                                     ErrCode = 3001
	ErrServicesDirectory                                 ErrCode = 4200
	ErrServicesDirectoryInvalidVerifiedCredentialSubject ErrCode = 4201
	ErrServicesDirectoryExistingRecordNotFound           ErrCode = 4202
	ErrServicesDirectoryRecordLockedAndCantBeReplaced    ErrCode = 4203
	ErrServicesDirectoryExplicitReplaceFlagRequired      ErrCode = 4204
	ErrServicesDirectoryInvalidVerifiedCredential        ErrCode = 4205
	ErrServicesDirectoryExpiredVerifiedCredential        ErrCode = 4206
	ErrServicesDirectoryInvalidVerifiedCredentialID      ErrCode = 4207
	ErrBertyAccount                                      ErrCode = 5000
	ErrBertyAccountNoIDSpecified                         ErrCode = 5001
	ErrBertyAccountAlreadyOpened                         ErrCode = 5002
	ErrBertyAccountInvalidIDFormat                       ErrCode = 5003
	ErrBertyAccountLoggerDecorator                       ErrCode = 5004
	ErrBertyAccountGRPCClient                            ErrCode = 5005
	ErrBertyAccountOpenAccount                           ErrCode = 5006
	ErrBertyAccountDataNotFound                          ErrCode = 5007
	ErrBertyAccountMetadataUpdate                        ErrCode = 5008
	ErrBertyAccountManagerOpen                           ErrCode = 5009
	ErrBertyAccountManagerClose                          ErrCode = 5010
	ErrBertyAccountInvalidCLIArgs                        ErrCode = 5011
	ErrBertyAccountFSError                               ErrCode = 5012
	ErrBertyAccountAlreadyExists                         ErrCode = 5013
	ErrBertyAccountNoBackupSpecified                     ErrCode = 5014
	ErrBertyAccountIDGenFailed                           ErrCode = 5015
	ErrBertyAccountCreationFailed                        ErrCode = 5016
	ErrBertyAccountUpdateFailed                          ErrCode = 5017
	ErrAppStorageNotSupported                            ErrCode = 5018
)

func Code

func Code(err error) ErrCode

Code returns the code of the actual error without trying to unwrap it, or -1.

func Codes added in v2.115.0

func Codes(err error) []ErrCode

Codes returns a list of wrapped codes

func FirstCode

func FirstCode(err error) ErrCode

FirstCode walks the passed error and returns the code of the first ErrCode met, or -1.

func LastCode

func LastCode(err error) ErrCode

LastCode walks the passed error and returns the code of the latest ErrCode, or -1.

func (ErrCode) Code

func (e ErrCode) Code() ErrCode

func (ErrCode) EnumDescriptor

func (ErrCode) EnumDescriptor() ([]byte, []int)

func (ErrCode) Error

func (e ErrCode) Error() string

func (ErrCode) GRPCStatus added in v2.115.0

func (e ErrCode) GRPCStatus() *status.Status

func (ErrCode) String

func (x ErrCode) String() string

func (ErrCode) Wrap

func (e ErrCode) Wrap(inner error) WithCode

type ErrDetails added in v2.115.0

type ErrDetails struct {
	Codes                []ErrCode `protobuf:"varint,1,rep,packed,name=codes,proto3,enum=berty.errcode.ErrCode" json:"codes,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*ErrDetails) Descriptor added in v2.115.0

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

func (*ErrDetails) GetCodes added in v2.115.0

func (m *ErrDetails) GetCodes() []ErrCode

func (*ErrDetails) Marshal added in v2.256.1

func (m *ErrDetails) Marshal() (dAtA []byte, err error)

func (*ErrDetails) MarshalTo added in v2.256.1

func (m *ErrDetails) MarshalTo(dAtA []byte) (int, error)

func (*ErrDetails) MarshalToSizedBuffer added in v2.256.1

func (m *ErrDetails) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ErrDetails) ProtoMessage added in v2.115.0

func (*ErrDetails) ProtoMessage()

func (*ErrDetails) Reset added in v2.115.0

func (m *ErrDetails) Reset()

func (*ErrDetails) Size added in v2.256.1

func (m *ErrDetails) Size() (n int)

func (*ErrDetails) String added in v2.115.0

func (m *ErrDetails) String() string

func (*ErrDetails) Unmarshal added in v2.256.1

func (m *ErrDetails) Unmarshal(dAtA []byte) error

func (*ErrDetails) XXX_DiscardUnknown added in v2.115.0

func (m *ErrDetails) XXX_DiscardUnknown()

func (*ErrDetails) XXX_Marshal added in v2.115.0

func (m *ErrDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ErrDetails) XXX_Merge added in v2.115.0

func (m *ErrDetails) XXX_Merge(src proto.Message)

func (*ErrDetails) XXX_Size added in v2.115.0

func (m *ErrDetails) XXX_Size() int

func (*ErrDetails) XXX_Unmarshal added in v2.115.0

func (m *ErrDetails) XXX_Unmarshal(b []byte) error

type WithCode

type WithCode interface {
	error
	Code() ErrCode
}

WithCode defines an error that can be used by helpers of this package.

Jump to

Keyboard shortcuts

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