Instead of try/catch with EnsureSuccessStatusCode, you can check if responseMessage.IsSuccessStatusCode