Is it correct to return 502 in the case a call to an API fails even if my API is not acting totally as a proxy, but rather as a client? Code example:
public async Task<IActionResult> CheckSomething(MyModel model)
{
try
{
var result = await _anotherApi.CheckSmt();
if (!result.Successful)
{
return StatusCode(StatusCodes.Status502BadGateway, $"Error on external API");
}
return Ok(result.Result);
}
catch (Exception ex)
{
}
}