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

Function Code

pkg/errors/codes.go:62–70  ·  view source on GitHub ↗

Code gets the code of an error. If the error doesn't implement codes, Unknown is returned.

(err error)

Source from the content-addressed store, hash-verified

60// Code gets the code of an error.
61// If the error doesn't implement codes, Unknown is returned.
62func Code(err error) uint32 {
63 if err == nil {
64 return uint32(codes.OK)
65 }
66 if code := code(err); code != 0 {
67 return code
68 }
69 return uint32(codes.Unknown)
70}
71
72// HasCode returns whether the given error has the given error code.
73// If the error doesn't implement codes, it doesn't have any code.

Callers 6

handlePacketMethod · 0.92
ServeHTTPMethod · 0.92
reportErrorFunction · 0.92
AfterQueryMethod · 0.92
ToHTTPStatusCodeFunction · 0.70
CodeMethod · 0.70

Calls 1

codeFunction · 0.85

Tested by

no test coverage detected