MCPcopy Create free account
hub / github.com/coder/agentapi / EmitError

Method EmitError

lib/httpapi/events.go:220–237  ·  view source on GitHub ↗
(message string, level st.ErrorLevel)

Source from the content-addressed store, hash-verified

218}
219
220func (e *EventEmitter) EmitError(message string, level st.ErrorLevel) {
221 e.mu.Lock()
222 defer e.mu.Unlock()
223
224 errorBody := ErrorBody{
225 Message: message,
226 Level: level,
227 Time: e.clock.Now(),
228 }
229
230 // Store the error so new subscribers can receive recent errors.
231 e.errors = append(e.errors, errorBody)
232 if len(e.errors) > maxStoredErrors {
233 e.errors = e.errors[len(e.errors)-maxStoredErrors:]
234 }
235
236 e.notifyChannels(EventTypeError, errorBody)
237}
238
239// Assumes the caller holds the lock.
240func (e *EventEmitter) currentStateAsEvents() []Event {

Callers 1

TestEventEmitterFunction · 0.95

Calls 1

notifyChannelsMethod · 0.95

Tested by 1

TestEventEmitterFunction · 0.76