WriteError queues an error message and closes the handler
(errorMsg string)
| 284 | |
| 285 | // WriteError queues an error message and closes the handler |
| 286 | func (h *SSEHandlerCh) WriteError(errorMsg string) error { |
| 287 | errorResp := map[string]interface{}{ |
| 288 | "type": AiMsgError, |
| 289 | "errorText": errorMsg, |
| 290 | } |
| 291 | if err := h.WriteJsonData(errorResp); err != nil { |
| 292 | return err |
| 293 | } |
| 294 | h.Close() |
| 295 | return nil |
| 296 | } |
| 297 | |
| 298 | // WriteEvent queues an SSE event with optional event type |
| 299 | func (h *SSEHandlerCh) WriteEvent(eventType, data string) error { |
nothing calls this directly
no test coverage detected