@@ -71,13 +71,22 @@ public long getActualOffset() {
7171 }
7272 }
7373
74- /** Stream has already been finalized. */
74+ /**
75+ * The write stream has already been finalized and will not accept further appends or flushes. To
76+ * send additional requests, you will need to create a new write stream via CreateWriteStream.
77+ */
7578 public static final class StreamFinalizedException extends StorageException {
7679 protected StreamFinalizedException (Status grpcStatus , String name ) {
7780 super (grpcStatus , name , null , null , ImmutableMap .of ());
7881 }
7982 }
8083
84+ /**
85+ * This writer instance has either been closed by the user explicitly, or has encountered
86+ * non-retriable errors.
87+ *
88+ * <p>To continue to write to the same stream, you will need to create a new writer instance.
89+ */
8190 public static final class StreamWriterClosedException extends StorageException {
8291 protected StreamWriterClosedException (Status grpcStatus , String name ) {
8392 super (grpcStatus , name , null , null , ImmutableMap .of ());
@@ -94,23 +103,36 @@ protected SchemaMismatchedException(Status grpcStatus, String name) {
94103 }
95104 }
96105
97- /** Offset already exists. */
106+ /**
107+ * Offset already exists. This indicates that the append request attempted to write data to an
108+ * offset before the current end of the stream. This is an expected exception when ExactOnce is
109+ * enforced. You can safely ignore it, and keep appending until there is new data to append.
110+ */
98111 public static final class OffsetAlreadyExists extends StorageException {
99112 protected OffsetAlreadyExists (
100113 Status grpcStatus , String name , Long expectedOffset , Long actualOffset ) {
101114 super (grpcStatus , name , expectedOffset , actualOffset , ImmutableMap .of ());
102115 }
103116 }
104117
105- /** Offset out of range. */
118+ /**
119+ * Offset out of range. This indicates that the append request is attempting to write data to a
120+ * point beyond the current end of the stream. To append data successfully, you must either
121+ * specify the offset corresponding to the current end of stream, or omit the offset from the
122+ * append request. It usually means a bug in your code that introduces a gap in appends.
123+ */
106124 public static final class OffsetOutOfRange extends StorageException {
107125 protected OffsetOutOfRange (
108126 Status grpcStatus , String name , Long expectedOffset , Long actualOffset ) {
109127 super (grpcStatus , name , expectedOffset , actualOffset , ImmutableMap .of ());
110128 }
111129 }
112130
113- /** Stream is not found. */
131+ /**
132+ * The stream is not found. Possible causes include incorrectly specifying the stream identifier
133+ * or attempting to use an old stream identifier that no longer exists. You can invoke
134+ * CreateWriteStream to create a new stream.
135+ */
114136 public static final class StreamNotFound extends StorageException {
115137 protected StreamNotFound (Status grpcStatus , String name ) {
116138 super (grpcStatus , name , null , null , ImmutableMap .of ());
0 commit comments