closedError returns an error if the attempt to read on a closed reader was made. If the reader had an error, it returns that error instead.
()
| 426 | // closedError returns an error if the attempt to read on a closed reader was made. |
| 427 | // If the reader had an error, it returns that error instead. |
| 428 | func (ab *AsyncBuffer) closedError() error { |
| 429 | // If the reader is closed, we return the error or nil |
| 430 | if !ab.closed.Load() { |
| 431 | return nil |
| 432 | } |
| 433 | |
| 434 | err := ab.Error() |
| 435 | if err == nil { |
| 436 | err = errors.New("asyncbuffer.AsyncBuffer.ReadAt: attempt to read on closed reader") |
| 437 | } |
| 438 | |
| 439 | return err |
| 440 | } |
| 441 | |
| 442 | // offsetAvailable checks if the data at the given offset is available for reading. |
| 443 | // It may return io.EOF if the reader is finished reading and the offset is beyond the end of the stream. |
no test coverage detected