Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GoCardlessSdk/Api/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private static Dictionary<string, object> ToHash(object obj)
{
}
ex.RawContent = response.Content;
ex.StatusCode = response.StatusCode;
throw ex;
}
return response.Data;
Expand Down
4 changes: 3 additions & 1 deletion GoCardlessSdk/Connect/ConnectClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public ConfirmResource ConfirmResource(NameValueCollection requestContent)
var response = client.Execute(request);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new ApiException("Unexpected response : " + (int)response.StatusCode + " " + response.StatusCode);
throw new ApiException("Unexpected response : " + (int)response.StatusCode + " " + response.StatusCode) {
StatusCode = response.StatusCode
};
}

return resource;
Expand Down
2 changes: 2 additions & 0 deletions GoCardlessSdk/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public ApiException(string message) : base(message)
public JObject Content { get; set; }

public string RawContent { get; set; }

public System.Net.HttpStatusCode StatusCode { get; set; }
}
public class ClientException : Exception
{
Expand Down
3 changes: 2 additions & 1 deletion GoCardlessSdk/Partners/PartnerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public MerchantAccessTokenResponse ParseCreateMerchantResponse(string redirectUr
{
throw new ApiException("Invalid response getting access token from " + tokenUrl)
{
Content = JObject.Parse(response.Content)
Content = JObject.Parse(response.Content),
StatusCode = response.StatusCode
};
}
}
Expand Down