MCPcopy Create free account
hub / github.com/cockroachdb/errors / GetDomain

Function GetDomain

domains/domains.go:36–49  ·  view source on GitHub ↗

GetDomain extracts the domain of the given error, or NoDomain if the error's cause does not have a domain annotation.

(err error)

Source from the content-addressed store, hash-verified

34// GetDomain extracts the domain of the given error, or NoDomain if
35// the error's cause does not have a domain annotation.
36func GetDomain(err error) Domain {
37 for {
38 if b, ok := err.(*withDomain); ok {
39 return b.domain
40 }
41 // Recurse to the cause.
42 if c := errbase.UnwrapOnce(err); c != nil {
43 err = c
44 continue
45 }
46 break
47 }
48 return NoDomain
49}
50
51// WithDomain wraps an error so that it appears to come from the given domain.
52//

Callers 9

GetDomainFunction · 0.92
TestNoDomainFunction · 0.92
TestNamedDomainFunction · 0.92
TestPackageDomainFunction · 0.92
TestWithDomainFunction · 0.92
TestHandledInDomainFunction · 0.92
BuildSentryReportFunction · 0.92
NotInDomainFunction · 0.70
EnsureNotInDomainFunction · 0.70

Calls 1

UnwrapOnceFunction · 0.92

Tested by 5

TestNoDomainFunction · 0.74
TestNamedDomainFunction · 0.74
TestPackageDomainFunction · 0.74
TestWithDomainFunction · 0.74
TestHandledInDomainFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…