Exemplo n.º 1
0
 public async Task OnGetAsync()
 {
     Scores = new List <HighScore>();
     try
     {
         //ILeaderboardClient proxy = RestService.For<ILeaderboardClient>(options.Value.BaseUrl);
         if (featureManager.IsEnabled(nameof(AppFeatureFlags.LeaderboardListLimit)))
         {
             int limit;
             Scores = await proxy.GetHighScores(Int32.TryParse(Request.Query["limit"], out limit)?limit : 5)
                      .ConfigureAwait(false);
         }
         else
         {
             Scores = await proxy.GetHighScores().ConfigureAwait(false);
         }
     }
     catch (HttpRequestException ex)
     {
         logger.LogWarning(ex, "Http request failed.");
     }
     catch (TimeoutRejectedException ex)
     {
         logger.LogWarning(ex, "Timeout occurred when retrieving high score list.");
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "Unknown exception occurred while retrieving high score list");
         throw;
     }
 }
 public async Task OnGetAsync()
 {
     Scores = new List <HighScore>();
     try
     {
         using (var operation = telemetryClient.StartOperation <RequestTelemetry>("LeaderboardWebAPICall"))
         {
             try
             {
                 Scores = await proxy.GetHighScores();
             }
             catch
             {
                 operation.Telemetry.Success = false;
                 throw;
             }
         }
     }
     catch (HttpRequestException ex)
     {
         logger.LogWarning(ex, "Http request failed.");
     }
     catch (TimeoutRejectedException ex)
     {
         logger.LogWarning(ex, "Timeout occurred when retrieving high score list.");
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "Unknown exception occurred while retrieving high score list");
     }
 }
Exemplo n.º 3
0
 public async Task OnGetAsync()
 {
     Scores = new List <HighScore>();
     try
     {
         //ILeaderboardClient proxy = RestService.For<ILeaderboardClient>(options.Value.BaseUrl);
         Scores = await proxy.GetHighScores();
     }
     catch (HttpRequestException ex)
     {
         logger.LogWarning(ex, "Http request failed.");
     }
     catch (TimeoutRejectedException ex)
     {
         logger.LogWarning(ex, "Timeout occurred when retrieving high score list.");
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "Unknown exception occurred while retrieving high score list");
     }
 }