MCPcopy Index your code
hub / github.com/cockroachdb/errors / SafeFormatter

Interface SafeFormatter

errbase/formatter.go:56–79  ·  view source on GitHub ↗

SafeFormatter is implemented by error leaf or wrapper types that want to separate safe and non-safe information when printed out. When multiple errors are chained (e.g. via errors.Wrap), intermediate layers in the error that do not implement SafeError are considered “unsafe”

Source from the content-addressed store, hash-verified

54// layers in the error that do not implement SafeError are considered
55// “unsafe”
56type SafeFormatter interface {
57 // SafeFormatError prints the receiver's first error.
58 //
59 // The provided Printer behaves like a redact.SafePrinter its
60 // Print() and Printf() methods conditionally add redaction markers
61 // around unsafe bits.
62 //
63 // The return value of SafeFormatError() decides what happens in the
64 // case the method is used to produce a "short" message, eg. when it
65 // is used to implement Error():
66 //
67 // - if it returns nil, then the short message
68 // contains no more than that produced for this error,
69 // even if the error has a further causal chain.
70 //
71 // - if it returns non-nil, then the short message
72 // contains the value printed by this error,
73 // followed by that of its causal chain.
74 // (e.g. thiserror: itscause: furthercause)
75 //
76 // Note that all the causal chain is reported in verbose reports in
77 // any case.
78 SafeFormatError(p Printer) (next error)
79}
80
81// A Printer formats error messages.
82//

Callers 1

formatRecursiveMethod · 0.65

Implementers 15

withContextcontexttags/with_context.go
barrierErrbarriers/barriers.go
withMarkmarkers/markers.go
werrFmtsafedetails/safedetails_test.go
withSafeDetailssafedetails/with_safedetails.go
withDomaindomains/with_domain.go
unimplementedErrorissuelink/unimplemented_error.go
withIssueLinkissuelink/with_issuelink.go
joinErrorjoin/join.go
withGrpcCodeextgrpc/ext_grpc.go
withSecondaryErrorsecondary/with_secondary.go
wrapElideCauseserrbase/format_error_internal_test.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…