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

Function Resemble

pkg/errors/comparison.go:20–34  ·  view source on GitHub ↗

Resemble returns true iff the given errors resemble, meaning that the Namespace and Name of the errors are equal. A nil error only resembles nil. Invalid errors or definitions (including typed nil) never resemble anything.

(a, b error)

Source from the content-addressed store, hash-verified

18// Namespace and Name of the errors are equal. A nil error only resembles nil.
19// Invalid errors or definitions (including typed nil) never resemble anything.
20func Resemble(a, b error) bool {
21 if a == nil && b == nil {
22 return true
23 }
24 ttnA, ok := From(a)
25 if !ok {
26 return false
27 }
28 ttnB, ok := From(b)
29 if !ok {
30 return false
31 }
32 return ttnA.Namespace() == ttnB.Namespace() &&
33 ttnA.Name() == ttnB.Name()
34}

Callers 12

JoinRequestMethod · 0.92
TestUplinkDataFrameFunction · 0.92
TestFromUplinkDataFrameFunction · 0.92
TestResemblesFunction · 0.92
ServeHTTPMethod · 0.92
TestGetRouterConfigFunction · 0.92
createEndDeviceMethod · 0.92
TestUserAccesLoginTokensFunction · 0.92
createGatewayMethod · 0.92
TestUserCreateFunction · 0.92
toErrorCodeFunction · 0.92

Calls 3

FromFunction · 0.85
NamespaceMethod · 0.65
NameMethod · 0.65

Tested by 7

TestUplinkDataFrameFunction · 0.74
TestFromUplinkDataFrameFunction · 0.74
TestResemblesFunction · 0.74
TestGetRouterConfigFunction · 0.74
TestUserAccesLoginTokensFunction · 0.74
TestUserCreateFunction · 0.74