Skip to content

Commit

Permalink
Cherry pick branch 'genexuslabs:rest-service-as-controller' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiamurialdo authored and Beta Bot committed Jan 8, 2025
1 parent 7b4c295 commit 67c858e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions dotnet/src/dotnetcore/GxClasses.Web/Middleware/GXRestServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected ActionResult UploadImpl()
SetStatusCode(HttpStatusCode.Created);
return GetResponse(new {object_id = fileToken});
}
protected ActionResult ErrorCheck(IGxSilentTrn trn)
protected void ErrorCheck(IGxSilentTrn trn)
{
if (trn.Errors() == 1)
{
Expand All @@ -146,12 +146,20 @@ protected ActionResult ErrorCheck(IGxSilentTrn trn)
_errorDetail = HandleError(HttpStatusCode.BadRequest.ToString(HttpHelper.INT_FORMAT), msgItem.gxTpr_Description);
}
}
}
protected ActionResult GetErrorResponse(IGxSilentTrn trn)
{
ErrorCheck(trn);
if (_errorDetail == null)
return NoContent();
else
return GetResponse(_errorDetail);

}
protected ActionResult GetErrorResponse(string code, string message)
{
return GetResponse(HandleError(code, message));
}

protected void SetMessages(msglist messages)
{
StringBuilder header = new StringBuilder();
Expand Down Expand Up @@ -344,7 +352,6 @@ internal WrappedJsonError HandleError(string code, string message)
SetErrorHeaders(HttpContext, httpStatusCode, message);
return HttpHelper.GetJsonError(code, message);
}

private void SetErrorHeaders(HttpContext httpContext, HttpStatusCode httpStatusCode, string message)
{
if (httpContext != null)
Expand Down

0 comments on commit 67c858e

Please sign in to comment.