aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/s3api/object_lock_utils.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/s3api/object_lock_utils.go b/weed/s3api/object_lock_utils.go
index e16ee4dc9..8ffadcecb 100644
--- a/weed/s3api/object_lock_utils.go
+++ b/weed/s3api/object_lock_utils.go
@@ -217,15 +217,15 @@ func ValidateObjectLockParameters(enabled bool, mode string, duration int32) err
}
if mode != s3_constants.RetentionModeGovernance && mode != s3_constants.RetentionModeCompliance {
- return fmt.Errorf("invalid object lock mode: %s, must be %s or %s", mode, s3_constants.RetentionModeGovernance, s3_constants.RetentionModeCompliance)
+ return createS3Error("InvalidObjectLockMode", fmt.Sprintf("Invalid object lock mode: %s. Must be %s or %s.", mode, s3_constants.RetentionModeGovernance, s3_constants.RetentionModeCompliance))
}
if duration <= 0 {
- return fmt.Errorf("object lock duration must be greater than 0 days, got: %d", duration)
+ return createS3Error("InvalidObjectLockDuration", fmt.Sprintf("Object lock duration must be greater than 0 days. Got: %d.", duration))
}
if duration > MaxRetentionDays {
- return fmt.Errorf("object lock duration exceeds maximum allowed days: %d, got: %d", MaxRetentionDays, duration)
+ return createS3Error("ObjectLockDurationExceeded", fmt.Sprintf("Object lock duration exceeds maximum allowed days: %d. Got: %d.", MaxRetentionDays, duration))
}
return nil