Skip to content

Commit

Permalink
Update sign up errors
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Aug 12, 2016
1 parent c826d0a commit 52b030d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Sources/AuthorizationClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,18 @@ public struct AuthorizationClient: NetworkClient {
return
}

if let errors = dictionary["errors"] as? JSONDictionary {
if let errors = dictionary["errors"] as? [JSONDictionary] {
var errorMessages = [String]()

for (key, values) in errors {
guard let values = values as? [String] else { continue }

for value in values {
errorMessages.append("\(key.capitalizedString) \(value).")

for container in errors {
guard let meta = container["meta"] as? JSONDictionary else { continue }

for (key, values) in meta {
guard let values = values as? [String] else { continue }

for value in values {
errorMessages.append("\(key.capitalizedString) \(value).")
}
}
}

Expand Down

0 comments on commit 52b030d

Please sign in to comment.