public static void Handle(this NotificationException e, HttpActionExecutedContext context)
        {
            var response = BuildContent(e.Messages);

            response.StatusCode = HttpStatusCode.BadRequest;
            context.Response    = response;
        }
Ejemplo n.º 2
0
        public void OnError(NotificationException notificationException)
        {
            INotificationEvents notificationEventsHandler = connectResourceManager.GetNotificationEventHandler();

            if (notificationEventsHandler != null)
            {
                notificationEventsHandler.OnError(notificationException);
            }
        }
Ejemplo n.º 3
0
        protected void OnError(/*Context context, */ String errorId)
        {
            Log.Debug(typeof(NotificationService).Name, "onError", "Error caught, " + errorId);

            NotificationException notificationException = new NotificationException(typeof(NotificationException).Name, "onError", "Error caught: " + errorId);

            NotificationManager notificationManager = NotificationManager.GetInstance();

            notificationManager.OnError(notificationException);
        }
Ejemplo n.º 4
0
        public static void HandleOnDbError(object source, string serializedArgs)
        {
            dynamic dbEx = JsonConvert.DeserializeObject(serializedArgs);

            try
            {
                LogServiceAsync <CustomLogServiceOptions> .Instance.LogMessage(serializedArgs);

                NotificationException notification = dbEx.notification.ToObject <NotificationException>();
                notification.Username   = HttpContext.Current.User.Identity.Name;
                notification.RawMessage = serializedArgs;
                DefaultNotificationClient.Instance.Notify(notification);
            }
            catch { }
        }
Ejemplo n.º 5
0
        public static void HandleOnExceptionLoggged(object source, string serializedArgs)
        {
            var logService = GlobalConfiguration.Configuration.DependencyResolver.GetService <ILogServiceAsync <ILogServiceSettings> >();

            var notificationClient = GlobalConfiguration.Configuration.DependencyResolver.GetService <INotificationClient>();

            logService.LogMessage(serializedArgs);


            if (notificationClient == null)
            {
                return;
            }

            dynamic unhandledException = JsonConvert.DeserializeObject(serializedArgs);

            NotificationException notification = unhandledException.notification.ToObject <NotificationException>();

            notification.RawMessage = unhandledException;
        }
        private static NotificationException createNotificationException(WebException ex)
        {
            NotificationException exception;

            if (ex.Status == WebExceptionStatus.ProtocolError)
            {
                var response = ex.Response as HttpWebResponse;
                if (response != null)
                {
                    exception = new NotificationException((int)response.StatusCode, ex.Message);
                }
                else
                {
                    exception = new NotificationException(ex.Message, ex);
                }
            }
            else
            {
                exception = new NotificationException(ex.Message, ex);
            }

            return(exception);
        }
 public ItemFailedEventArgs(Guid id, NotificationException exception)
 {
     Id        = id;
     Exception = exception;
 }
Ejemplo n.º 8
0
 private void OnItemFailed(ReminderItem item, NotificationException exception)
 {
     _storage.Update(item.Failed());
     ItemFailed?.Invoke(this, new ItemFailedEventArgs(item.Id, exception));
 }
Ejemplo n.º 9
0
 public ReminderFailedEventArgs(Guid id, NotificationException exception)
 {
     Id        = id;
     Exception = exception;
 }