Skip to content

Commit

Permalink
Merge branch 'master' into TIS-766
Browse files Browse the repository at this point in the history
  • Loading branch information
Gering112 authored Jul 30, 2024
2 parents 1ce70af + 77d46f6 commit 32cdf2f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2

jobs:
build:
resource_class: riskified/container-agent
docker:
- image: mono

Expand Down Expand Up @@ -42,6 +43,7 @@ jobs:
- Riskified.SDK.*.nupkg

deploy:
resource_class: riskified/container-agent
docker:
- image: mono
steps:
Expand Down
2 changes: 2 additions & 0 deletions Riskified.SDK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]


[assembly: AssemblyVersion("3.8.0")]
[assembly: AssemblyFileVersion("3.8.0")]


17 changes: 10 additions & 7 deletions Riskified.SDK/Utils/HttpUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public static TRespObj JsonPostAndParseResponseToObject<TRespObj,TReqObj>(Uri ri
where TReqObj : class
{
var response = PostObject<TReqObj>(riskifiedWebhookUrl, jsonObj, authToken, shopDomain);

var resObj = ParseObjectFromJsonResponse<TRespObj>(response);
return resObj;
}
Expand Down Expand Up @@ -105,22 +104,27 @@ private static HttpWebResponse PostObject<TReqObj>(Uri riskifiedWebhookUrl, TReq
if (wex.Response != null)
{
HttpWebResponse errorResponse = (HttpWebResponse)wex.Response;
HttpStatusCode statusCode = errorResponse.StatusCode;


try
{
var errorObj = ParseObjectFromJsonResponse<ErrorResponse>(errorResponse);
error = errorObj.Error.Message + " (Http Status code: " + errorResponse.StatusCode + ")";
error = errorObj.Error.Message + " (Http Status code: " + statusCode + ")";

}
catch (Exception parseEx)
{
if (errorResponse.StatusCode == HttpStatusCode.InternalServerError)
if (statusCode == HttpStatusCode.InternalServerError)
error = "Server side error (500): ";
else if (errorResponse.StatusCode == HttpStatusCode.BadRequest)
else if (statusCode == HttpStatusCode.BadRequest)
error = "Client side error (400): ";
else
error = "Error occurred. Http status code " + errorResponse.StatusCode + ":";
error = "Error occurred. Http status code " + statusCode + ":";
error += parseEx.Message;
}


}
LoggingServices.Error(error, wex);
throw new RiskifiedTransactionException(error, wex);
Expand All @@ -131,7 +135,6 @@ private static HttpWebResponse PostObject<TReqObj>(Uri riskifiedWebhookUrl, TReq
LoggingServices.Error(errorMsg, e);
throw new RiskifiedTransactionException(errorMsg, e);
}

return response;
}

Expand Down Expand Up @@ -184,8 +187,8 @@ private static T ParseObjectFromJsonResponse<T>(WebResponse response) where T :
finally
{
response.Close();
}

}
return JsonStringToObject<T>(responseBody);
}

Expand Down

0 comments on commit 32cdf2f

Please sign in to comment.