MCPcopy Create free account
hub / github.com/charmbracelet/bubbletea / keepWriteErr

Method keepWriteErr

tea.go:1404–1413  ·  view source on GitHub ↗

keepWriteErr remembers err as the error to return from [Program.Run] if it is the first error writing to the output. Later errors are dropped so they do not hide the first one.

(err error)

Source from the content-addressed store, hash-verified

1402// is the first error writing to the output. Later errors are dropped so they
1403// do not hide the first one.
1404func (p *Program) keepWriteErr(err error) {
1405 if err == nil {
1406 return
1407 }
1408 p.writeErrMu.Lock()
1409 defer p.writeErrMu.Unlock()
1410 if p.writeErr == nil {
1411 p.writeErr = err
1412 }
1413}
1414
1415// firstWriteErr returns the first error kept by keepWriteErr.
1416func (p *Program) firstWriteErr() error {

Callers 6

restoreTerminalStateMethod · 0.95
drainQueryRepliesMethod · 0.95
eventLoopMethod · 0.95
flushFrameMethod · 0.95
stopRendererMethod · 0.95

Calls

no outgoing calls

Tested by 1