MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Code

Method Code

pkg/errors/codes.go:31–42  ·  view source on GitHub ↗

Code of the error. If the code is invalid or unknown, this tries to get the code from the cause of this error. This code is consistent with google.golang.org/genproto/googleapis/rpc/code and google.golang.org/grpc/codes.

()

Source from the content-addressed store, hash-verified

29// If the code is invalid or unknown, this tries to get the code from the cause of this error.
30// This code is consistent with google.golang.org/genproto/googleapis/rpc/code and google.golang.org/grpc/codes.
31func (e *Error) Code() uint32 {
32 if e == nil {
33 return 0
34 }
35 if e.code != 0 && e.code != uint32(codes.Unknown) {
36 return e.code
37 }
38 if e.cause != nil {
39 return Code(e.cause)
40 }
41 return uint32(codes.Unknown)
42}
43
44func code(err error) uint32 {
45 switch {

Callers 1

GRPCStatusMethod · 0.95

Calls 1

CodeFunction · 0.70

Tested by

no test coverage detected