aboutsummaryrefslogtreecommitdiff
path: root/writer.go
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-02-16 06:12:04 +0100
committerOnur Gündüz <ogunduz@gmail.com>2026-02-16 06:12:04 +0100
commita50720227917ecd4770c667345f41fa88a4fda0b (patch)
treec153fcf3526b75810a2683ac49daf4b1748bae2a /writer.go
parent6f612c117d33c383d2ac37d258c3d90f10717998 (diff)
downloadmp4-a50720227917ecd4770c667345f41fa88a4fda0b.tar.gz
mp4-a50720227917ecd4770c667345f41fa88a4fda0b.zip
Add Err method to Writer
Diffstat (limited to 'writer.go')
-rw-r--r--writer.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/writer.go b/writer.go
index 2e431ee..10bf27b 100644
--- a/writer.go
+++ b/writer.go
@@ -9,6 +9,7 @@ type writerFrame struct {
type Writer struct {
buf []byte
pos int
+ err error // first deferred error
stack [maxDepth]writerFrame
depth int
}
@@ -26,6 +27,9 @@ func (w *Writer) Bytes() []byte {
// Len returns the number of bytes written.
func (w *Writer) Len() int { return w.pos }
+// Err returns the first deferred error encountered during writing.
+func (w *Writer) Err() error { return w.err }
+
// Write appends raw bytes. Implements io.Writer.
func (w *Writer) Write(p []byte) (int, error) {
copy(w.buf[w.pos:], p)