Rather than parsing the response message for string values, which is subject to the message changing in later versions, I recommend adding a StatusCode property to the ApiException class.
I'd submit a diff for all the changes, but unfortunately I've had to make a lot of changes to get it running in .Net 3.5, so the diffs wouldn't be valid. In short, just set the StatusCode property everywhere where the ApiException is created.
--- GoCardlessSdk\Exceptions.cs.old 2013-06-04 09:37:26.000000000 +0100
+++ GoCardlessSdk\Exceptions.cs 2013-11-12 14:52:33.325566900 +0000
@@ -11,6 +11,8 @@
public JObject Content { get; set; }
public string RawContent { get; set; }
+
+ public System.Net.HttpStatusCode StatusCode { get; set; }
}
public class ClientException : Exception
{
Rather than parsing the response message for string values, which is subject to the message changing in later versions, I recommend adding a StatusCode property to the ApiException class.
I'd submit a diff for all the changes, but unfortunately I've had to make a lot of changes to get it running in .Net 3.5, so the diffs wouldn't be valid. In short, just set the StatusCode property everywhere where the ApiException is created.