예제 #1
0
        public async Task ReportActivityAsync(string activity)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(this.requestContext.Request);
            var developer     = await this.developerRepository.TryGetByGitNameAsync(developerName);

            await this.activityReporter.ReportActivityAsync(activity, developer);
        }
        public Task ReportExceptionAndCreateResponseAsync <T>(
            BaseValidatingContext <T> context,
            Exception exception)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(context.Request);

            return(ExceptionHandlerUtilities.ReportExceptionAndCreateResponseAsync(context, exception, developerName));
        }
        public Task <HttpResponseMessage> ReportExceptionAndCreateResponseAsync(
            HttpRequestMessage request,
            Exception exception)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(request);

            return(ExceptionHandlerUtilities.ReportExceptionAndCreateResponseAsync(request, exception, developerName));
        }
예제 #4
0
 public override async Task OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
 {
     if (actionContext.ModelState.IsValid == false)
     {
         var exception     = new ModelValidationException(actionContext.ModelState);
         var developerName = ExceptionHandlerUtilities.GetDeveloperName(actionContext.Request);
         actionContext.Response = await ExceptionHandlerUtilities.ReportExceptionAndCreateResponseAsync(actionContext.Request, exception, developerName);
     }
 }
        public override async Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
        {
            var exception = actionExecutedContext.Exception;

            if (exception != null)
            {
                var developerName = ExceptionHandlerUtilities.GetDeveloperName(actionExecutedContext.Request);
                actionExecutedContext.Response = await ExceptionHandlerUtilities.ReportExceptionAndCreateResponseAsync(actionExecutedContext.Request, exception, developerName);
            }
        }
예제 #6
0
        public async void ReportActivityInBackground(string activity)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(this.requestContext.Request);
            var developer     = await this.developerRepository.TryGetByGitNameAsync(developerName);

            try
            {
                await this.activityReporter.ReportActivityAsync(activity, developer);
            }
            catch (Exception t)
            {
                this.exceptionHandler.ReportExceptionAsync(t, developerName);
            }
        }
예제 #7
0
        private static async Task ConfigureAsync()
        {
            try
            {
                var storageAccount = (ICloudStorageAccount)GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(ICloudStorageAccount));

                await ConfigureStorage(storageAccount);
                await ConfigureCors(storageAccount);
            }
            catch (Exception t)
            {
                ExceptionHandlerUtilities.ReportExceptionAsync(t, null);
            }
        }
예제 #8
0
        private static async Task ConfigureCors(ICloudStorageAccount storageAccount)
        {
            try
            {
                var blobClient = storageAccount.CreateCloudBlobClient();

                var blobServiceProperties = await blobClient.GetServicePropertiesAsync();

                ConfigureCors(blobServiceProperties);
                await blobClient.SetServicePropertiesAsync(blobServiceProperties);
            }
            catch (Exception t)
            {
                ExceptionHandlerUtilities.ReportExceptionAsync(t, null);
            }
        }
예제 #9
0
        private static async Task ConfigureStorage(ICloudStorageAccount storageAccount)
        {
            try
            {
                var cloudQueueClient = storageAccount.CreateCloudQueueClient();
                await CreateQueueIfNotExists(cloudQueueClient, WebJobs.Thumbnails.Shared.Constants.ThumbnailsQueueName);
                await CreateQueueIfNotExists(cloudQueueClient, Fifthweek.GarbageCollection.Shared.Constants.GarbageCollectionQueueName);
                await CreateQueueIfNotExists(cloudQueueClient, Payments.Shared.Constants.RequestSnapshotQueueName);
                await CreateQueueIfNotExists(cloudQueueClient, Payments.Shared.Constants.RequestProcessPaymentsQueueName);

                var cloudBlobClient = storageAccount.CreateCloudBlobClient();
                await CreateBlobContainerIfNotExists(cloudBlobClient, Payments.Shared.Constants.PaymentProcessingDataContainerName);
                await CreateBlobIfNotExists(cloudBlobClient, Fifthweek.Azure.Constants.AzureLeaseObjectsContainerName, Payments.Shared.Constants.ProcessPaymentsLeaseObjectName);
                await CreateBlobIfNotExists(cloudBlobClient, Fifthweek.Azure.Constants.AzureLeaseObjectsContainerName, WebJobs.GarbageCollection.Shared.Constants.LeaseObjectName);
                await CreateBlobContainerIfNotExists(cloudBlobClient, Constants.PublicFileBlobContainerName);
            }
            catch (Exception t)
            {
                ExceptionHandlerUtilities.ReportExceptionAsync(t, null);
            }
        }
예제 #10
0
        public void Configuration(IAppBuilder app)
        {
            try
            {
                var httpConfiguration = new HttpConfiguration();

                IdentityConfig.Register(app);
                DapperConfig.Register();
                AutofacConfig.Register(httpConfiguration, app);
                AzureConfig.Register();
                OAuthConfig.Register(httpConfiguration, app);
                DatabaseConfig.Register();
                WebApiConfig.Register(httpConfiguration);

                app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
                app.UseWebApi(httpConfiguration);
            }
            catch (Exception t)
            {
                ExceptionHandlerUtilities.ReportExceptionAsync(t, null);
                throw;
            }
        }
예제 #11
0
 public void ReportExceptionAsync(Exception exception, string developerName)
 {
     ExceptionHandlerUtilities.ReportExceptionAsync(exception, developerName);
 }
예제 #12
0
        public void ReportExceptionAsync(Exception exception)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(this.requestContext.Request);

            ExceptionHandlerUtilities.ReportExceptionAsync(exception, developerName);
        }
        public void ReportExceptionAsync(IOwinRequest request, Exception exception)
        {
            var developerName = ExceptionHandlerUtilities.GetDeveloperName(request);

            ExceptionHandlerUtilities.ReportExceptionAsync(exception, developerName);
        }