errcode

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0, MIT Imports: 10 Imported by: 3

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{
	0:    "Undefined",
	666:  "TODO",
	777:  "ErrNotImplemented",
	888:  "ErrInternal",
	100:  "ErrInvalidInput",
	101:  "ErrInvalidRange",
	102:  "ErrMissingInput",
	103:  "ErrSerialization",
	104:  "ErrDeserialization",
	105:  "ErrStreamRead",
	106:  "ErrStreamWrite",
	110:  "ErrStreamTransform",
	111:  "ErrStreamSendAndClose",
	112:  "ErrStreamHeaderWrite",
	115:  "ErrStreamHeaderRead",
	113:  "ErrStreamSink",
	114:  "ErrStreamCloseAndRecv",
	107:  "ErrMissingMapKey",
	108:  "ErrDBWrite",
	109:  "ErrDBRead",
	120:  "ErrDBDestroy",
	121:  "ErrDBMigrate",
	122:  "ErrDBReplay",
	123:  "ErrDBRestore",
	124:  "ErrDBOpen",
	125:  "ErrDBClose",
	200:  "ErrCryptoRandomGeneration",
	201:  "ErrCryptoKeyGeneration",
	202:  "ErrCryptoNonceGeneration",
	203:  "ErrCryptoSignature",
	204:  "ErrCryptoSignatureVerification",
	205:  "ErrCryptoDecrypt",
	206:  "ErrCryptoDecryptPayload",
	207:  "ErrCryptoEncrypt",
	208:  "ErrCryptoKeyConversion",
	209:  "ErrCryptoCipherInit",
	210:  "ErrCryptoKeyDerivation",
	300:  "ErrMap",
	301:  "ErrForEach",
	400:  "ErrKeystoreGet",
	401:  "ErrKeystorePut",
	404:  "ErrNotFound",
	1000: "ErrOrbitDBInit",
	1001: "ErrOrbitDBOpen",
	1002: "ErrOrbitDBAppend",
	1003: "ErrOrbitDBDeserialization",
	1004: "ErrOrbitDBStoreCast",
	1100: "ErrHandshakeOwnEphemeralKeyGenSend",
	1101: "ErrHandshakePeerEphemeralKeyRecv",
	1102: "ErrHandshakeRequesterAuthenticateBoxKeyGen",
	1103: "ErrHandshakeResponderAcceptBoxKeyGen",
	1104: "ErrHandshakeRequesterHello",
	1105: "ErrHandshakeResponderHello",
	1106: "ErrHandshakeRequesterAuthenticate",
	1107: "ErrHandshakeResponderAccept",
	1108: "ErrHandshakeRequesterAcknowledge",
	1200: "ErrContactRequestSameAccount",
	1201: "ErrContactRequestContactAlreadyAdded",
	1202: "ErrContactRequestContactBlocked",
	1203: "ErrContactRequestContactUndefined",
	1204: "ErrContactRequestIncomingAlreadyReceived",
	1300: "ErrGroupMemberLogEventOpen",
	1301: "ErrGroupMemberLogEventSignature",
	1302: "ErrGroupMemberUnknownGroupID",
	1303: "ErrGroupSecretOtherDestMember",
	1304: "ErrGroupSecretAlreadySentToMember",
	1305: "ErrGroupInvalidType",
	1306: "ErrGroupMissing",
	1307: "ErrGroupActivate",
	1308: "ErrGroupDeactivate",
	1309: "ErrGroupInfo",
	1310: "ErrGroupUnknown",
	1311: "ErrGroupOpen",
	1500: "ErrMessageKeyPersistencePut",
	1501: "ErrMessageKeyPersistenceGet",
	4100: "ErrServiceReplication",
	4101: "ErrServiceReplicationServer",
	4102: "ErrServiceReplicationMissingEndpoint",
	4200: "ErrServicesDirectory",
	4201: "ErrServicesDirectoryInvalidVerifiedCredentialSubject",
	4202: "ErrServicesDirectoryExistingRecordNotFound",
	4203: "ErrServicesDirectoryRecordLockedAndCantBeReplaced",
	4204: "ErrServicesDirectoryExplicitReplaceFlagRequired",
	4205: "ErrServicesDirectoryInvalidVerifiedCredential",
	4206: "ErrServicesDirectoryExpiredVerifiedCredential",
	4207: "ErrServicesDirectoryInvalidVerifiedCredentialID",
}
View Source
var ErrCode_value = map[string]int32{
	"Undefined":                          0,
	"TODO":                               666,
	"ErrNotImplemented":                  777,
	"ErrInternal":                        888,
	"ErrInvalidInput":                    100,
	"ErrInvalidRange":                    101,
	"ErrMissingInput":                    102,
	"ErrSerialization":                   103,
	"ErrDeserialization":                 104,
	"ErrStreamRead":                      105,
	"ErrStreamWrite":                     106,
	"ErrStreamTransform":                 110,
	"ErrStreamSendAndClose":              111,
	"ErrStreamHeaderWrite":               112,
	"ErrStreamHeaderRead":                115,
	"ErrStreamSink":                      113,
	"ErrStreamCloseAndRecv":              114,
	"ErrMissingMapKey":                   107,
	"ErrDBWrite":                         108,
	"ErrDBRead":                          109,
	"ErrDBDestroy":                       120,
	"ErrDBMigrate":                       121,
	"ErrDBReplay":                        122,
	"ErrDBRestore":                       123,
	"ErrDBOpen":                          124,
	"ErrDBClose":                         125,
	"ErrCryptoRandomGeneration":          200,
	"ErrCryptoKeyGeneration":             201,
	"ErrCryptoNonceGeneration":           202,
	"ErrCryptoSignature":                 203,
	"ErrCryptoSignatureVerification":     204,
	"ErrCryptoDecrypt":                   205,
	"ErrCryptoDecryptPayload":            206,
	"ErrCryptoEncrypt":                   207,
	"ErrCryptoKeyConversion":             208,
	"ErrCryptoCipherInit":                209,
	"ErrCryptoKeyDerivation":             210,
	"ErrMap":                             300,
	"ErrForEach":                         301,
	"ErrKeystoreGet":                     400,
	"ErrKeystorePut":                     401,
	"ErrNotFound":                        404,
	"ErrOrbitDBInit":                     1000,
	"ErrOrbitDBOpen":                     1001,
	"ErrOrbitDBAppend":                   1002,
	"ErrOrbitDBDeserialization":          1003,
	"ErrOrbitDBStoreCast":                1004,
	"ErrHandshakeOwnEphemeralKeyGenSend": 1100,
	"ErrHandshakePeerEphemeralKeyRecv":   1101,
	"ErrHandshakeRequesterAuthenticateBoxKeyGen":           1102,
	"ErrHandshakeResponderAcceptBoxKeyGen":                 1103,
	"ErrHandshakeRequesterHello":                           1104,
	"ErrHandshakeResponderHello":                           1105,
	"ErrHandshakeRequesterAuthenticate":                    1106,
	"ErrHandshakeResponderAccept":                          1107,
	"ErrHandshakeRequesterAcknowledge":                     1108,
	"ErrContactRequestSameAccount":                         1200,
	"ErrContactRequestContactAlreadyAdded":                 1201,
	"ErrContactRequestContactBlocked":                      1202,
	"ErrContactRequestContactUndefined":                    1203,
	"ErrContactRequestIncomingAlreadyReceived":             1204,
	"ErrGroupMemberLogEventOpen":                           1300,
	"ErrGroupMemberLogEventSignature":                      1301,
	"ErrGroupMemberUnknownGroupID":                         1302,
	"ErrGroupSecretOtherDestMember":                        1303,
	"ErrGroupSecretAlreadySentToMember":                    1304,
	"ErrGroupInvalidType":                                  1305,
	"ErrGroupMissing":                                      1306,
	"ErrGroupActivate":                                     1307,
	"ErrGroupDeactivate":                                   1308,
	"ErrGroupInfo":                                         1309,
	"ErrGroupUnknown":                                      1310,
	"ErrGroupOpen":                                         1311,
	"ErrMessageKeyPersistencePut":                          1500,
	"ErrMessageKeyPersistenceGet":                          1501,
	"ErrServiceReplication":                                4100,
	"ErrServiceReplicationServer":                          4101,
	"ErrServiceReplicationMissingEndpoint":                 4102,
	"ErrServicesDirectory":                                 4200,
	"ErrServicesDirectoryInvalidVerifiedCredentialSubject": 4201,
	"ErrServicesDirectoryExistingRecordNotFound":           4202,
	"ErrServicesDirectoryRecordLockedAndCantBeReplaced":    4203,
	"ErrServicesDirectoryExplicitReplaceFlagRequired":      4204,
	"ErrServicesDirectoryInvalidVerifiedCredential":        4205,
	"ErrServicesDirectoryExpiredVerifiedCredential":        4206,
	"ErrServicesDirectoryInvalidVerifiedCredentialID":      4207,
}

Functions

func Has

func Has(err error, code WithCode) bool

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

func Is

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
	ErrOrbitDBInit                                       ErrCode = 1000
	ErrOrbitDBOpen                                       ErrCode = 1001
	ErrOrbitDBAppend                                     ErrCode = 1002
	ErrOrbitDBDeserialization                            ErrCode = 1003
	ErrOrbitDBStoreCast                                  ErrCode = 1004
	ErrHandshakeOwnEphemeralKeyGenSend                   ErrCode = 1100
	ErrHandshakePeerEphemeralKeyRecv                     ErrCode = 1101
	ErrHandshakeRequesterAuthenticateBoxKeyGen           ErrCode = 1102
	ErrHandshakeResponderAcceptBoxKeyGen                 ErrCode = 1103
	ErrHandshakeRequesterHello                           ErrCode = 1104
	ErrHandshakeResponderHello                           ErrCode = 1105
	ErrHandshakeRequesterAuthenticate                    ErrCode = 1106
	ErrHandshakeResponderAccept                          ErrCode = 1107
	ErrHandshakeRequesterAcknowledge                     ErrCode = 1108
	ErrContactRequestSameAccount                         ErrCode = 1200
	ErrContactRequestContactAlreadyAdded                 ErrCode = 1201
	ErrContactRequestContactBlocked                      ErrCode = 1202
	ErrContactRequestContactUndefined                    ErrCode = 1203
	ErrContactRequestIncomingAlreadyReceived             ErrCode = 1204
	ErrGroupMemberLogEventOpen                           ErrCode = 1300
	ErrGroupMemberLogEventSignature                      ErrCode = 1301
	ErrGroupMemberUnknownGroupID                         ErrCode = 1302
	ErrGroupSecretOtherDestMember                        ErrCode = 1303
	ErrGroupSecretAlreadySentToMember                    ErrCode = 1304
	ErrGroupInvalidType                                  ErrCode = 1305
	ErrGroupMissing                                      ErrCode = 1306
	ErrGroupActivate                                     ErrCode = 1307
	ErrGroupDeactivate                                   ErrCode = 1308
	ErrGroupInfo                                         ErrCode = 1309
	ErrGroupUnknown                                      ErrCode = 1310
	ErrGroupOpen                                         ErrCode = 1311
	ErrMessageKeyPersistencePut                          ErrCode = 1500
	ErrMessageKeyPersistenceGet                          ErrCode = 1501
	ErrServiceReplication                                ErrCode = 4100
	ErrServiceReplicationServer                          ErrCode = 4101
	ErrServiceReplicationMissingEndpoint                 ErrCode = 4102
	ErrServicesDirectory                                 ErrCode = 4200
	ErrServicesDirectoryInvalidVerifiedCredentialSubject ErrCode = 4201
	ErrServicesDirectoryExistingRecordNotFound           ErrCode = 4202
	ErrServicesDirectoryRecordLockedAndCantBeReplaced    ErrCode = 4203
	ErrServicesDirectoryExplicitReplaceFlagRequired      ErrCode = 4204
	ErrServicesDirectoryInvalidVerifiedCredential        ErrCode = 4205
	ErrServicesDirectoryExpiredVerifiedCredential        ErrCode = 4206
	ErrServicesDirectoryInvalidVerifiedCredentialID      ErrCode = 4207
)

func Code

func Code(err error) ErrCode

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

func Codes

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

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

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

func (*ErrDetails) Descriptor

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

func (*ErrDetails) GetCodes

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

func (*ErrDetails) Marshal

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

func (*ErrDetails) MarshalTo

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

func (*ErrDetails) MarshalToSizedBuffer

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

func (*ErrDetails) ProtoMessage

func (*ErrDetails) ProtoMessage()

func (*ErrDetails) Reset

func (m *ErrDetails) Reset()

func (*ErrDetails) Size

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

func (*ErrDetails) String

func (m *ErrDetails) String() string

func (*ErrDetails) Unmarshal

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

func (*ErrDetails) XXX_DiscardUnknown

func (m *ErrDetails) XXX_DiscardUnknown()

func (*ErrDetails) XXX_Marshal

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

func (*ErrDetails) XXX_Merge

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

func (*ErrDetails) XXX_Size

func (m *ErrDetails) XXX_Size() int

func (*ErrDetails) XXX_Unmarshal

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