public async Task <IActionResult> AddClientSideError(CreateClientSideErrorLogModel createClientSideErrorLogModel, CancellationToken cancellationToken) { await this.ClientSideErrorLogService.AddClientSideErrorAsync(createClientSideErrorLogModel, cancellationToken); return(Ok()); }
public async Task AddClientSideErrorAsync(CreateClientSideErrorLogModel createClientSideErrorLogModel, CancellationToken cancellationToken) { await this.FairplaytubeDatabaseContext.ClientSideErrorLog.AddAsync( new DataAccess.Models.ClientSideErrorLog() { FullException = createClientSideErrorLogModel.FullException, Message = createClientSideErrorLogModel.Message, StackTrace = createClientSideErrorLogModel.StackTrace }, cancellationToken); await this.FairplaytubeDatabaseContext.SaveChangesAsync(cancellationToken); }
public async Task AddClientSideErrorAsync(CreateClientSideErrorLogModel createClientSideErrorLogModel) { var anonymousHttpClient = this.HttpClientService.CreateAnonymousClient(); var response = await anonymousHttpClient.PostAsJsonAsync <CreateClientSideErrorLogModel>( Constants.ApiRoutes.ClientSideErrorLogController.AddClientSideError, createClientSideErrorLogModel); if (!response.IsSuccessStatusCode) { var problemHttpResponse = await response.Content.ReadFromJsonAsync <ProblemHttpResponse>(); if (problemHttpResponse != null) { throw new CustomValidationException(problemHttpResponse.Detail); } else { throw new CustomValidationException(response.ReasonPhrase); } } }