ErrorMessage is used to provide by default a generic error message to the user unless showErrToUser is true
(l *log.Helper)
| 80 | // ErrorMessage is used to provide by default a generic error message to the user |
| 81 | // unless showErrToUser is true |
| 82 | func (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 | |
| 100 | type oauthHandler struct { |
| 101 | H func(*AuthService, http.ResponseWriter, *http.Request) *oauthResp |