You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
863 B
C#
36 lines
863 B
C#
using Newtonsoft.Json;
|
|
|
|
namespace Amazon.SellingPartnerApiSDK.Misc
|
|
{
|
|
public static class ErrorResponseHelper
|
|
{
|
|
public static ErrorResponse ConvertToErrorResponse(this string response)
|
|
{
|
|
if (string.IsNullOrEmpty(response)) return null;
|
|
|
|
try
|
|
{
|
|
return JsonConvert.DeserializeObject<ErrorResponse>(response);
|
|
}
|
|
catch
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public class ErrorResponse
|
|
{
|
|
[JsonProperty("errors")] public ErrorResponseElement[] Errors;
|
|
}
|
|
|
|
public class ErrorResponseElement
|
|
{
|
|
[JsonProperty("message")] public string Message { get; set; }
|
|
|
|
[JsonProperty("code")] public string Code { get; set; }
|
|
|
|
[JsonProperty("details")] public string Details { get; set; }
|
|
}
|
|
} |