MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / ErrorMessage

Method ErrorMessage

app/controlplane/internal/service/auth.go:82–98  ·  view source on GitHub ↗

ErrorMessage is used to provide by default a generic error message to the user unless showErrToUser is true

(l *log.Helper)

Source from the content-addressed store, hash-verified

80// ErrorMessage is used to provide by default a generic error message to the user
81// unless showErrToUser is true
82func (e *oauthResp) ErrorMessage(l *log.Helper) string {
83 if e.err != nil {
84 // If the error is an internal server error, log it and raise it masked
85 if e.code == http.StatusInternalServerError {
86 return sl.LogAndMaskErr(e.err, l).Error()
87 }
88 // otherwise return the error message to the user
89 // or the default status text
90 if e.showErrToUser {
91 return e.err.Error()
92 }
93
94 return http.StatusText(e.code)
95 }
96
97 return ""
98}
99
100type oauthHandler struct {
101 H func(*AuthService, http.ResponseWriter, *http.Request) *oauthResp

Callers 1

ServeHTTPMethod · 0.80

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected