Пример #1
0
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))
		}
	}
}
Пример #2
0
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)
}
Пример #3
0
func SetErrorResponseContext(err error, res *http.Response) {
	errutil.ErrorSetContext(err, "Status", res.Status)
	setErrorHeaderContext(err, "Request", res.Header)
	setErrorRequestContext(err, res.Request)
}