Skip to content

Commit

Permalink
chore(storage): align storage validation exception message with Ampli…
Browse files Browse the repository at this point in the history
…fy Android (#3612)
  • Loading branch information
phantumcode authored and lawmicha committed Apr 16, 2024
1 parent bf92152 commit cff728d
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,9 @@ extension StoragePath {
}

func validate(_ path: String) throws {
guard !path.isEmpty else {
let errorDescription = "Invalid StoragePath specified."
let recoverySuggestion = "Please specify a valid StoragePath"
throw StorageError.validation("path", errorDescription, recoverySuggestion, nil)
}

if path.hasPrefix("/") {
let errorDescription = "Invalid StoragePath specified."
let recoverySuggestion = "Please specify a valid StoragePath that does not contain the prefix / "
if path.isEmpty || path.hasPrefix("/") {
let errorDescription = "Invalid StoragePath provided."
let recoverySuggestion = "StoragePath must not be empty or start with /"
throw StorageError.validation("path", errorDescription, recoverySuggestion, nil)
}
}
Expand Down

0 comments on commit cff728d

Please sign in to comment.