(rctx *CopilotRequestContext, sink *responseSink, exchange *pendingExchange)
| 655 | } |
| 656 | |
| 657 | func (a *copilotRequestAdapter) runHandler(rctx *CopilotRequestContext, sink *responseSink, exchange *pendingExchange) { |
| 658 | err := a.handler.handle(rctx, sink) |
| 659 | if err != nil { |
| 660 | if exchange.ctx.Err() != nil { |
| 661 | a.finishCancelled(sink, exchange) |
| 662 | return |
| 663 | } |
| 664 | a.failViaSink(sink, exchange, err.Error()) |
| 665 | return |
| 666 | } |
| 667 | exchange.mu.Lock() |
| 668 | finished := exchange.finished |
| 669 | exchange.mu.Unlock() |
| 670 | if !finished { |
| 671 | a.failViaSink(sink, exchange, "CopilotRequestHandler returned without finalising the response") |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | func (a *copilotRequestAdapter) failViaSink(sink *responseSink, exchange *pendingExchange, message string) { |
| 676 | exchange.mu.Lock() |
no test coverage detected