MCPcopy
hub / github.com/openai/openai-go / Error

Struct Error

internal/apierror/apierror.go:17–34  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

15// made and the API returns a response with a HTTP status code. Other errors are
16// not wrapped by this SDK.
17type Error struct {
18 Code string `json:"code" api:"required"`
19 Message string `json:"message" api:"required"`
20 Param string `json:"param" api:"required"`
21 Type string `json:"type" api:"required"`
22 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
23 JSON struct {
24 Code respjson.Field
25 Message respjson.Field
26 Param respjson.Field
27 Type respjson.Field
28 ExtraFields map[string]respjson.Field
29 raw string
30 } `json:"-"`
31 StatusCode int
32 Request *http.Request
33 Response *http.Response
34}
35
36// Returns the unmodified JSON received from the API
37func (r Error) RawJSON() string { return r.JSON.raw }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected