func setErrorHeaderContext(err error, prefix string, head http.Header) { for key, _ := range head { contextKey := fmt.Sprintf("%s:%s", prefix, key) if _, skip := hiddenHeaders[key]; skip { errutil.ErrorSetContext(err, contextKey, "--") } else { errutil.ErrorSetContext(err, contextKey, head.Get(key)) } } }
func setErrorRequestContext(err error, req *http.Request) { errutil.ErrorSetContext(err, "Endpoint", config.Config.Endpoint(auth.GetOperationForRequest(req)).Url) errutil.ErrorSetContext(err, "URL", TraceHttpReq(req)) setErrorHeaderContext(err, "Response", req.Header) }
func SetErrorResponseContext(err error, res *http.Response) { errutil.ErrorSetContext(err, "Status", res.Status) setErrorHeaderContext(err, "Request", res.Header) setErrorRequestContext(err, res.Request) }