Пример #1
0
		private string CacheTestHandledException (string uuid)
		{
			string res = "";
			
			Exception exc1 = new Exception ("Test exception");
			var request = new BugSenseExceptionRequest (exc1.ToBugSenseEx (null, true, "", "_ping|ev1|ev2"),
				BugSenseEnvironment.GetEnvironment ("test", "0.0.0.0", uuid, true),
				new Dictionary<string, string> () {
					{ "k1", "val1"},
					{ "k2", "val2"},
					{ "k3", "val3"}
			});
			
			LogError err = new LogError (request, false);
			Task.Run (async () => {
				res = await err.Execute ();
			}).Wait ();
			
			return res;
		}
 /// <summary>
 /// Make sure to set screen size/orientation before calling this!
 /// </summary>
 public static void HandleError(Exception e, string comment)
 {
     var request = new BugSenseRequest(e.ToBugSenseEx(comment), Instance.GetEnvironment());
     try
     {
         Instance.Send(request);
     }
     catch (Exception ex1)
     {
     }
 }
 private void Handle(Exception e, string comment, NotificationOptions options, bool throwExceptionAfterComplete = false)
 {
     if (DateTime.Now.AddSeconds(-1) < _lastMethodHandledCalledAt) {
         return;
     }
     _lastMethodHandledCalledAt = DateTime.Now;
     if (Debugger.IsAttached && !options.HandleWhileDebugging)//Dont send the error
         return;
     var request = new BugSenseRequest(e.ToBugSenseEx(comment), GetEnvironment());
     if (throwExceptionAfterComplete) {
         LogAndSend(request, true);
         return;
     }
     try {
         switch (options.Type) {
             case enNotificationType.MessageBox:
                 if (!NotificationBox.IsOpen())
                     NotificationBox.Show(options.Title, options.Text, new NotificationBoxCommand(Labels.OkMessage, () => { }));
                 LogAndSend(request);
                 break;
             case enNotificationType.MessageBoxConfirm:
                 if (!NotificationBox.IsOpen())
                     Scheduler.Dispatcher.Schedule(
                         () => {
                             try {
                                 if (!NotificationBox.IsOpen())
                                     NotificationBox.Show(options.Title, options.Text,
                                                          new NotificationBoxCommand(Labels.OkMessage, () => LogAndSend(request)),
                                                          new NotificationBoxCommand(Labels.CancelMessage, () => { }));
                             }
                             catch { }
                         });
                 break;
             default:
                 LogAndSend(request);
                 break;
         }
     }
     catch (Exception) {
         if (options.Type != enNotificationType.MessageBoxConfirm) {
             LogAndSend(request);
         }
     }
 }
 //private void OnBugSenseUnhandledException(BugSenseUnhandledExceptionEventArgs e)
 //{
 //    EventHandler<BugSenseUnhandledExceptionEventArgs> handler = UnhandledException;
 //    if (handler != null)
 //        handler(this, e);
 //}
 private void Handle(Exception e, string comment)
 {
     var request = new BugSenseRequest(e.ToBugSenseEx(comment), GetEnvironment());
     try {
         Send(request);
     }
     catch (Exception ex1) {
     }
 }