Skip to content

Commit 8e2bfa7

Browse files
authored
chore(storage): align storage validation exception message with Amplify Android (#3612)
1 parent 3169654 commit 8e2bfa7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/StoragePath+Extensions.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,9 @@ extension StoragePath {
4141
}
4242

4343
func validate(_ path: String) throws {
44-
guard !path.isEmpty else {
45-
let errorDescription = "Invalid StoragePath specified."
46-
let recoverySuggestion = "Please specify a valid StoragePath"
47-
throw StorageError.validation("path", errorDescription, recoverySuggestion, nil)
48-
}
49-
50-
if path.hasPrefix("/") {
51-
let errorDescription = "Invalid StoragePath specified."
52-
let recoverySuggestion = "Please specify a valid StoragePath that does not contain the prefix / "
44+
if path.isEmpty || path.hasPrefix("/") {
45+
let errorDescription = "Invalid StoragePath provided."
46+
let recoverySuggestion = "StoragePath must not be empty or start with /"
5347
throw StorageError.validation("path", errorDescription, recoverySuggestion, nil)
5448
}
5549
}

0 commit comments

Comments
 (0)