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

Method formatSimple

errbase/format_error.go:577–593  ·  view source on GitHub ↗

formatSimple performs a best effort at extracting the details at a given level of wrapping when the error object does not implement the Formatter interface. Returns true if we want to elide errors from causal chain.

(err, cause error)

Source from the content-addressed store, hash-verified

575// the Formatter interface.
576// Returns true if we want to elide errors from causal chain.
577func (s *state) formatSimple(err, cause error) bool {
578 var pref string
579 elideCauses := false
580 if cause != nil {
581 var messageType MessageType
582 pref, messageType = extractPrefix(err, cause)
583 if messageType == FullMessage {
584 elideCauses = true
585 }
586 } else {
587 pref = err.Error()
588 }
589 if len(pref) > 0 {
590 s.Write([]byte(pref))
591 }
592 return elideCauses
593}
594
595// finishDisplay renders s.finalBuf into s.State.
596func (p *state) finishDisplay(verb rune) {

Callers 1

formatRecursiveMethod · 0.95

Calls 3

WriteMethod · 0.95
extractPrefixFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected