MCPcopy Create free account
hub / github.com/github/copilot-sdk / sinkError

Method sinkError

go/copilot_request_handler.go:824–850  ·  view source on GitHub ↗
(message string, code string)

Source from the content-addressed store, hash-verified

822}
823
824func (s *responseSink) sinkError(message string, code string) error {
825 s.exchange.mu.Lock()
826 if s.exchange.finished {
827 s.exchange.mu.Unlock()
828 return nil
829 }
830 s.exchange.finished = true
831 s.exchange.mu.Unlock()
832 s.adapter.removePending(s.requestID)
833 api, err := s.rpcAPI()
834 if err != nil {
835 return err
836 }
837 end := true
838 chunkErr := &rpc.LlmInferenceHTTPResponseChunkError{Message: message}
839 if code != "" {
840 c := code
841 chunkErr.Code = &c
842 }
843 _, err = api.HttpResponseChunk(context.Background(), &rpc.LlmInferenceHTTPResponseChunkRequest{
844 RequestID: s.requestID,
845 Data: "",
846 End: &end,
847 Error: chunkErr,
848 })
849 return err
850}

Callers 4

streamResponseToSinkFunction · 0.80
failMethod · 0.80
failViaSinkMethod · 0.80
finishCancelledMethod · 0.80

Calls 3

rpcAPIMethod · 0.95
removePendingMethod · 0.80
HttpResponseChunkMethod · 0.80

Tested by

no test coverage detected