lib/spaceship/tunes/tunes_client.rb in spaceship-0.5.2 vs lib/spaceship/tunes/tunes_client.rb in spaceship-0.5.3
- old
+ new
@@ -44,11 +44,11 @@
if response['Set-Cookie'] =~ /myacinfo=(\w+);/
# To use the session properly we'll need the following cookies:
# - myacinfo
# - woinst
# - wosid
-
+ # - itctx
begin
re = response['Set-Cookie']
to_use = [
"myacinfo=" + re.match(/myacinfo=([^;]*)/)[1],
@@ -57,17 +57,21 @@
"wosid=" + re.match(/wosid=([^;]*)/)[1]
]
@cookie = to_use.join(';')
rescue
- # User Credentials are wrong
- raise InvalidUserCredentialsError.new, response
+ raise ITunesConnectError.new, [response.body, response['Set-Cookie']].join("\n")
end
return @client
else
- # User Credentials are wrong
- raise InvalidUserCredentialsError.new, response
+ if (response.body || "").include?("You have successfully signed out")
+ # User Credentials are wrong
+ raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
+ else
+ info = [response.body, response['Set-Cookie']]
+ raise ITunesConnectError.new, info.join("\n")
+ end
end
end
def handle_itc_response(raw)
return unless raw