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

Function NewResponseError

aibridge/intercept/openai_errors.go:44–54  ·  view source on GitHub ↗

NewResponseError builds a ResponseError with the OpenAI-shaped envelope. errType and code should be one of the OpenAIErrType* and OpenAIErrCode* constants defined above.

(msg, errType, code string, status int, retryAfter time.Duration)

Source from the content-addressed store, hash-verified

42// envelope. errType and code should be one of the OpenAIErrType*
43// and OpenAIErrCode* constants defined above.
44func NewResponseError(msg, errType, code string, status int, retryAfter time.Duration) *ResponseError {
45 return &ResponseError{
46 ErrorObject: &shared.ErrorObject{
47 Code: code,
48 Message: msg,
49 Type: errType,
50 },
51 StatusCode: status,
52 RetryAfter: retryAfter,
53 }
54}
55
56func (e *ResponseError) Error() string {
57 if e.ErrorObject == nil {

Callers 5

TestWriteUpstreamErrorFunction · 0.92
mapStreamErrorMethod · 0.92
TestWriteUpstreamErrorFunction · 0.92
ResponseErrorFromKeyPoolFunction · 0.70

Calls

no outgoing calls

Tested by 2

TestWriteUpstreamErrorFunction · 0.74
TestWriteUpstreamErrorFunction · 0.74