MCPcopy Index your code
hub / github.com/coder/coder / ToResponse

Method ToResponse

aibridge/intercept/openai_errors.go:65–71  ·  view source on GitHub ↗

ToResponse marshals e into an *http.Response shaped for the OpenAI API.

()

Source from the content-addressed store, hash-verified

63// ToResponse marshals e into an *http.Response shaped for the
64// OpenAI API.
65func (e *ResponseError) ToResponse() *http.Response {
66 body, err := json.Marshal(e)
67 if err != nil {
68 body = []byte(`{"error":{"type":"error","message":"error marshaling upstream error","code":"server_error"}}`)
69 }
70 return utils.NewJSONErrorResponse(e.StatusCode, e.RetryAfter, body)
71}
72
73// ResponseErrorFromKeyPool translates a *keypool.Error into
74// a developer-facing ResponseError shaped for the OpenAI API.

Callers 2

KeyFailoverConfigMethod · 0.45
KeyFailoverConfigMethod · 0.45

Calls 2

NewJSONErrorResponseFunction · 0.92
MarshalMethod · 0.45

Tested by

no test coverage detected