(message string, code string)
| 822 | } |
| 823 | |
| 824 | func (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 | } |
no test coverage detected