Skip to content

Commit

Permalink
what if we just turn debug on in tests always
Browse files Browse the repository at this point in the history
  • Loading branch information
cewkrupa committed Nov 20, 2024
1 parent c81e65d commit 272be03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ func newTestClient(t *testing.T) *client.Client {
if !ok {
t.Fatal("expected environment variable " + client.DefaultAPIKeyEnv)
}
_, debug := os.LookupEnv("HONEYCOMBIO_DEBUG")

c, err := client.NewClientWithConfig(&client.Config{
APIKey: apiKey,
Debug: debug,
Debug: true,
UserAgent: testUserAgent,
})
require.NoError(t, err, "failed to create client")
Expand Down
5 changes: 2 additions & 3 deletions client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package client
import (
"encoding/json"
"errors"
"fmt"
"net/http"

"github.com/hashicorp/jsonapi"
Expand Down Expand Up @@ -66,7 +65,7 @@ func (e *DetailedError) IsNotFound() bool {

// Error returns a pretty-printed representation of the error
func (e DetailedError) Error() string {
response := fmt.Sprintf("ID: %s\n", e.ID)
response := ""
if len(e.Details) > 0 {
for index, details := range e.Details {
response += details.String()
Expand All @@ -81,7 +80,7 @@ func (e DetailedError) Error() string {
return response
}

return response + e.Message
return e.Message
}

func ErrorFromResponse(r *http.Response) error {
Expand Down

0 comments on commit 272be03

Please sign in to comment.