Skip to content

Commit

Permalink
Merge pull request #4 from Hexaville/noppoMan-patch-2
Browse files Browse the repository at this point in the history
show body data for the error response
  • Loading branch information
noppoMan committed Jul 12, 2017
2 parents 6a0ae68 + 22c173c commit fbf3000
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/HexavilleAuth/HexaviileAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ public enum HexavilleAuthError: Error {
case responseError(Response)
}

extension HexavilleAuthError: CustomStringConvertible {
public var description: String {
switch self {
case .responseError(let response):
var str = ""
str += "\(response)"
str += "\n"
str += "\n"
str += String(data: response.body.asData(), encoding: .utf8) ?? "Unknown Error"
return str

default:
return "\(self)"
}
}
}

public enum CredentialProviderType {
case oauth2(OAuth2AuthorizationProvidable)
case oauth1(OAuth1AuthorizationProvidable)
Expand Down

0 comments on commit fbf3000

Please sign in to comment.