Esempio n. 1
0
        public async Task <IActionResult> AddClientSideError(CreateClientSideErrorLogModel createClientSideErrorLogModel,
                                                             CancellationToken cancellationToken)
        {
            await this.ClientSideErrorLogService.AddClientSideErrorAsync(createClientSideErrorLogModel, cancellationToken);

            return(Ok());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
                }
            }
        }