diff options
| author | Dax Raad <[email protected]> | 2025-12-07 15:52:27 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-12-07 15:52:27 -0500 |
| commit | 13b2cf50aeb791f4b47786f95c8572a5caa75c7e (patch) | |
| tree | cea24f522f7e0de330475bf0be7803cdf1a33371 /packages/sdk/go/internal/apierror | |
| parent | 93b0abfce9660c4da21026b138857bf408aa4cae (diff) | |
| download | opencode-13b2cf50aeb791f4b47786f95c8572a5caa75c7e.tar.gz opencode-13b2cf50aeb791f4b47786f95c8572a5caa75c7e.zip | |
remove outdated SDKs
Diffstat (limited to 'packages/sdk/go/internal/apierror')
| -rw-r--r-- | packages/sdk/go/internal/apierror/apierror.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/packages/sdk/go/internal/apierror/apierror.go b/packages/sdk/go/internal/apierror/apierror.go deleted file mode 100644 index 24307fc36..000000000 --- a/packages/sdk/go/internal/apierror/apierror.go +++ /dev/null @@ -1,53 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package apierror - -import ( - "fmt" - "net/http" - "net/http/httputil" - - "github.com/sst/opencode-sdk-go/internal/apijson" -) - -// Error represents an error that originates from the API, i.e. when a request is -// made and the API returns a response with a HTTP status code. Other errors are -// not wrapped by this SDK. -type Error struct { - JSON errorJSON `json:"-"` - StatusCode int - Request *http.Request - Response *http.Response -} - -// errorJSON contains the JSON metadata for the struct [Error] -type errorJSON struct { - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Error) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r errorJSON) RawJSON() string { - return r.raw -} - -func (r *Error) Error() string { - // Attempt to re-populate the response body - return fmt.Sprintf("%s \"%s\": %d %s %s", r.Request.Method, r.Request.URL, r.Response.StatusCode, http.StatusText(r.Response.StatusCode), r.JSON.RawJSON()) -} - -func (r *Error) DumpRequest(body bool) []byte { - if r.Request.GetBody != nil { - r.Request.Body, _ = r.Request.GetBody() - } - out, _ := httputil.DumpRequestOut(r.Request, body) - return out -} - -func (r *Error) DumpResponse(body bool) []byte { - out, _ := httputil.DumpResponse(r.Response, body) - return out -} |
