Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Java Client: throw exception when assign fails

Chris Lu4d0b894d3787
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
index f8c0c76b68..75d2a0e7e9 100644
--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
@@ -1,5 +1,6 @@
package seaweedfs.client;
+import com.google.common.base.Strings;
import com.google.protobuf.ByteString;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -50,6 +51,11 @@ public class SeaweedWrite {
.setTtlSec(0)
.setPath(path)
.build());
+
+ if (!Strings.isNullOrEmpty(response.getError())) {
+ throw new IOException(response.getError());
+ }
+
String fileId = response.getFileId();
String auth = response.getAuth();