(err error, errorID string, log logrus.FieldLogger)
| 327 | } |
| 328 | |
| 329 | func getErrorQueryString(err error, errorID string, log logrus.FieldLogger) *url.Values { |
| 330 | q := url.Values{} |
| 331 | switch e := err.(type) { |
| 332 | case *HTTPError: |
| 333 | if str, ok := oauthErrorMap[e.Code]; ok { |
| 334 | q.Set("error", str) |
| 335 | } else { |
| 336 | q.Set("error", "server_error") |
| 337 | } |
| 338 | if e.Code >= http.StatusInternalServerError { |
| 339 | e.ErrorID = errorID |
| 340 | // this will get us the stack trace too |
| 341 | log.WithError(e.Cause()).Error(e.Error()) |
| 342 | } else { |
| 343 | log.WithError(e.Cause()).Info(e.Error()) |
| 344 | } |
| 345 | q.Set("error_description", e.Message) |
| 346 | case *OAuthError: |
| 347 | q.Set("error", e.Err) |
| 348 | q.Set("error_description", e.Description) |
| 349 | log.WithError(e.Cause()).Info(e.Error()) |
| 350 | case ErrorCause: |
| 351 | return getErrorQueryString(e.Cause(), errorID, log) |
| 352 | default: |
| 353 | q.Set("error", "server_error") |
| 354 | q.Set("error_description", err.Error()) |
| 355 | } |
| 356 | return &q |
| 357 | } |
| 358 | |
| 359 | func (a *API) getExternalRedirectURL(r *http.Request) string { |
| 360 | ctx := r.Context() |
no test coverage detected
searching dependent graphs…