MCPcopy
hub / github.com/getsops/sops / UserError

Method UserError

usererrors.go:83–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81}
82
83func (r *decryptGroupError) UserError() string {
84 var status string
85 if r.err == nil {
86 status = statusSuccess
87 } else {
88 status = statusFailed
89 }
90 header := fmt.Sprintf(`Group %s: %s`, r.groupName, status)
91 if r.err == nil {
92 return header
93 }
94 message := r.err.Error()
95 if userError, ok := r.err.(UserError); ok {
96 message = userError.UserError()
97 }
98 reader := prefixer.New(strings.NewReader(message), " ")
99 // Safe to ignore this error, as reading from a strings.Reader can't fail
100 errMsg, _ := io.ReadAll(reader)
101 return fmt.Sprintf("%s\n%s", header, string(errMsg))
102}
103
104type decryptKeyErrors []error
105

Callers 1

UserErrorMethod · 0.95

Calls 2

UserErrorMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected