Skip to content

Commit

Permalink
remove error wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
funwithbots committed Jun 10, 2024
1 parent a2227cb commit c7da0c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package brave

import (
"encoding/json"
"fmt"
"net/http"
)

func handleRequest[T any](client *http.Client, req *http.Request) (*T, error) {
res, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("error in request %s: %w", req.URL.String(), err)
return nil, err
}

defer res.Body.Close()
Expand Down
4 changes: 2 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ func (er ErrorResponse) Format(f fmt.State, c rune) {
e.Type, strings.Join(e.Loc, "."), e.Input, e.Message))
}

fmt.Fprintf(f, "error: %s (ID: %s; Status: %d; Code: %s); details: %s",
er.Detail, er.ID, er.Status, er.Code, strings.Join(meta, ", "))
fmt.Fprintf(f, "error: %s (ID: %s; Status: %d; Code: %s RawQuery: %s); details: %s",
er.Detail, er.ID, er.Status, er.Code, strings.Join(meta, ", "), er.RawQuery)
} else {
fmt.Fprint(f, er.Detail)
}
Expand Down

0 comments on commit c7da0c0

Please sign in to comment.