Skip to content

Commit

Permalink
Export the internal api.httpError
Browse files Browse the repository at this point in the history
  • Loading branch information
sridharavinash committed Dec 2, 2021
1 parent 3a8fab4 commit 6596865
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func newHTTPClient(opts *api.ClientOptions) http.Client {
return http.Client{Transport: transport, Timeout: opts.Timeout}
}

type httpError struct {
type HttpError struct {
StatusCode int
RequestURL *url.URL
Message string
Expand All @@ -129,7 +129,7 @@ type httpErrorItem struct {
Code string
}

func (err httpError) Error() string {
func (err HttpError) Error() string {
if msgs := strings.SplitN(err.Message, "\n", 2); len(msgs) > 1 {
return fmt.Sprintf("HTTP %d: %s (%s)\n%s", err.StatusCode, msgs[0], err.RequestURL, msgs[1])
} else if err.Message != "" {
Expand All @@ -139,7 +139,7 @@ func (err httpError) Error() string {
}

func handleHTTPError(resp *http.Response) error {
httpError := httpError{
httpError := HttpError{
StatusCode: resp.StatusCode,
RequestURL: resp.Request.URL,
OAuthScopes: resp.Header.Get("X-Oauth-Scopes"),
Expand Down

0 comments on commit 6596865

Please sign in to comment.