MCPcopy Create free account
hub / github.com/GetStream/stream-go2 / makeStreamError

Method makeStreamError

client.go:412–427  ·  view source on GitHub ↗
(statusCode int, rate *Rate, body io.Reader)

Source from the content-addressed store, hash-verified

410}
411
412func (c *Client) makeStreamError(statusCode int, rate *Rate, body io.Reader) error {
413 if body == nil {
414 return errors.New("invalid body")
415 }
416 errBody, err := io.ReadAll(body)
417 if err != nil {
418 return err
419 }
420 var streamErr APIError
421 if err := json.Unmarshal(errBody, &streamErr); err != nil {
422 return fmt.Errorf("unexpected error (status code %d)", statusCode)
423 }
424 streamErr.StatusCode = statusCode
425 streamErr.Rate = rate
426 return streamErr
427}
428
429type endpoint struct {
430 url *url.URL

Callers 2

requestMethod · 0.95
Test_makeStreamErrorFunction · 0.80

Calls

no outgoing calls

Tested by 1

Test_makeStreamErrorFunction · 0.64