From 7f470a9928f30fc02ee8461b755ba9a434df92e6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 18 Mar 2026 11:33:07 -0700 Subject: [PATCH] fix destroy to use VolumeError::NotEmpty instead of generic Io error The dedicated NotEmpty variant exists in the enum but was not being used. This makes error matching consistent with Go's ErrVolumeNotEmpty. --- seaweed-volume/src/storage/volume.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/seaweed-volume/src/storage/volume.rs b/seaweed-volume/src/storage/volume.rs index 932fa1f6e..bf0f14d4a 100644 --- a/seaweed-volume/src/storage/volume.rs +++ b/seaweed-volume/src/storage/volume.rs @@ -2979,10 +2979,7 @@ impl Volume { /// Remove all volume files from disk. pub fn destroy(&mut self, only_empty: bool) -> Result<(), VolumeError> { if only_empty && self.file_count() > 0 { - return Err(VolumeError::Io(io::Error::new( - io::ErrorKind::Other, - "volume not empty".to_string(), - ))); + return Err(VolumeError::NotEmpty); } if self.is_compacting { return Err(VolumeError::Io(io::Error::new(