Skip to content

Commit

Permalink
move RawQuery to ErrorResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
funwithbots committed Jun 10, 2024
1 parent 44ef9bf commit a2227cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
7 changes: 3 additions & 4 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func handleRequest[T any](client *http.Client, req *http.Request) (*T, error) {
}

resp.Error.Time = resp.Time
resp.RawQuery = req.URL.RawQuery
resp.Error.RawQuery = req.URL.RawQuery
return nil, resp.Error
}

Expand All @@ -34,7 +34,6 @@ func handleRequest[T any](client *http.Client, req *http.Request) (*T, error) {
}

type errorResponse struct {
Error ErrorResponse `json:"error"`
RawQuery string `json:"raw_query"`
Time *Timestamp `json:"time"`
Error ErrorResponse `json:"error"`
Time *Timestamp `json:"time"`
}
13 changes: 7 additions & 6 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,13 @@ type Offer struct {
}

type ErrorResponse struct {
ID string `json:"id"`
Status int `json:"status"`
Code string `json:"code"`
Detail string `json:"detail"`
Meta ErrorMeta `json:"meta"`
Time *Timestamp `json:"-"`
ID string `json:"id"`
Status int `json:"status"`
Code string `json:"code"`
Detail string `json:"detail"`
Meta ErrorMeta `json:"meta"`
RawQuery string `json:"raw_query"`
Time *Timestamp `json:"-"`
}

func (er ErrorResponse) Error() string {
Expand Down

0 comments on commit a2227cb

Please sign in to comment.