public static void HandleException(VCException e) { if (e.InnerException is AggregateException) { var aggregateException = e.InnerException as AggregateException; foreach (var exception in aggregateException.InnerExceptions) { if (exception is VCException) HandleException((VCException)exception); else HandleException(new VCException(exception.Message, exception.StackTrace, exception)); } } else { OnNextUpdate.Do(() => { if (e is VCConnectionTimeoutException) HandleConnectionTimeOut(e as VCConnectionTimeoutException); else if (e is VCLocalCopyLockedException) HandleLocalCopyLocked(e as VCLocalCopyLockedException); else if (e is VCNewerVersionException) HandleNewerVersion(e as VCNewerVersionException); else if (e is VCOutOfDate) HandleOutOfDate(e as VCOutOfDate); else if (e is VCCriticalException) HandleCritical(e as VCCriticalException); else if (e is VCMissingCredentialsException) HandleUserCredentials(); else if (e is VCMonoDebuggerAttachedException) HandleMonoDebuggerAttached(e as VCMonoDebuggerAttachedException); else HandleBase(e); }); } }
private static void HandleBase(VCException e) { Debug.LogException(e.InnerException != null ? e.InnerException : e); if(!string.IsNullOrEmpty(e.ErrorMessage)) GoogleAnalytics.LogUserEvent("Exception", e.ErrorMessage); var dialog = CustomDialogs.CreateExceptionDialog("UVC Exception", e); if (VCSettings.BugReport) { dialog.AddButton("Report", () => ReportError(e)); } dialog.ShowUtility(); EditorUtility.ClearProgressBar(); }
public static CustomDialog CreateExceptionDialog(string title, string message, VCException e) { bool stackTraceToggle = false; bool innerStackTraceToggle = false; bool detailsToggle = false; bool isCritical = e is VCCriticalException; Vector2 scrollPos = Vector2.zero; CustomDialog dialog = CustomDialog.Create(title); dialog .CenterOnScreen() .SetBodyGUI(() => { if (e != null) { scrollPos = GUILayout.BeginScrollView(scrollPos); if (!string.IsNullOrEmpty(message)) { EditorGUILayout.HelpBox(message, isCritical ? MessageType.Error : MessageType.Warning); } if (!string.IsNullOrEmpty(e.ErrorDetails)) { detailsToggle = GUILayout.Toggle(detailsToggle, "Details", EditorStyles.foldout); if (detailsToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.ErrorDetails); GUILayout.EndVertical(); } } } if (!string.IsNullOrEmpty(e.StackTrace)) { stackTraceToggle = GUILayout.Toggle(stackTraceToggle, "Stacktrace", EditorStyles.foldout); if (stackTraceToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.StackTrace); GUILayout.EndVertical(); } } } if (e.InnerException != null) { if (!string.IsNullOrEmpty(e.InnerException.StackTrace)) { innerStackTraceToggle = GUILayout.Toggle(innerStackTraceToggle, "Inner Stacktrace", EditorStyles.foldout); if (innerStackTraceToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.InnerException.StackTrace); GUILayout.EndVertical(); } } } } GUILayout.FlexibleSpace(); GUILayout.EndScrollView(); } }) .AddButton("OK", () => dialog.Close(), GUILayout.Width(60f)) .AddButton("Copy To Clipboard", () => { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Title: {0}\r\n\r\n", title); if (!string.IsNullOrEmpty(message)) { sb.AppendFormat("Message: {0}\r\n", message); } if (!string.IsNullOrEmpty(e.ErrorDetails)) { sb.AppendFormat("\r\nDetails:\r\n{0}\r\n", e.ErrorDetails); } if (!string.IsNullOrEmpty(e.StackTrace)) { sb.AppendFormat("\r\nStacktrace:\r\n{0}\r\n", e.StackTrace); } if (e.InnerException != null && !string.IsNullOrEmpty(e.StackTrace)) { sb.AppendFormat("\r\nInner Stacktrace:\r\n{0}\r\n", e.InnerException.StackTrace); } EditorGUIUtility.systemCopyBuffer = sb.ToString(); }); return(dialog); }
public static CustomDialog CreateExceptionDialog(string title, VCException e) { return(CreateExceptionDialog(title, e.ErrorMessage, e)); }
public static CustomDialog CreateExceptionDialog(string title, VCException e) { return CreateExceptionDialog(title, e.ErrorMessage, e); }
public static CustomDialog CreateExceptionDialog(string title, string message, VCException e) { bool stackTraceToggle = false; bool innerStackTraceToggle = false; bool detailsToggle = false; bool isCritical = e is VCCriticalException; Vector2 scrollPos = Vector2.zero; CustomDialog dialog = CustomDialog.Create(title); dialog .CenterOnScreen() .SetBodyGUI(() => { if (e != null) { scrollPos = GUILayout.BeginScrollView(scrollPos); if (!string.IsNullOrEmpty(message)) { EditorGUILayout.HelpBox(message, isCritical ? MessageType.Error : MessageType.Warning); } if (!string.IsNullOrEmpty(e.ErrorDetails)) { detailsToggle = GUILayout.Toggle(detailsToggle, "Details", EditorStyles.foldout); if (detailsToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.ErrorDetails); GUILayout.EndVertical(); } } } if (!string.IsNullOrEmpty(e.StackTrace)) { stackTraceToggle = GUILayout.Toggle(stackTraceToggle, "Stacktrace", EditorStyles.foldout); if (stackTraceToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.StackTrace); GUILayout.EndVertical(); } } } if (e.InnerException != null) { if (!string.IsNullOrEmpty(e.InnerException.StackTrace)) { innerStackTraceToggle = GUILayout.Toggle(innerStackTraceToggle, "Inner Stacktrace", EditorStyles.foldout); if (innerStackTraceToggle) { using (GUILayoutHelper.VerticalIdented(14)) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.TextField(e.InnerException.StackTrace); GUILayout.EndVertical(); } } } } GUILayout.FlexibleSpace(); GUILayout.EndScrollView(); } }) .AddButton("OK", () => dialog.Close(), GUILayout.Width(60f)) .AddButton("Copy To Clipboard", () => { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Title: {0}\r\n\r\n", title); if (!string.IsNullOrEmpty(message)) sb.AppendFormat("Message: {0}\r\n", message); if (!string.IsNullOrEmpty(e.ErrorDetails)) sb.AppendFormat("\r\nDetails:\r\n{0}\r\n", e.ErrorDetails); if (!string.IsNullOrEmpty(e.StackTrace)) sb.AppendFormat("\r\nStacktrace:\r\n{0}\r\n", e.StackTrace); if (e.InnerException != null && !string.IsNullOrEmpty(e.StackTrace)) sb.AppendFormat("\r\nInner Stacktrace:\r\n{0}\r\n", e.InnerException.StackTrace); EditorGUIUtility.systemCopyBuffer = sb.ToString(); }); return dialog; }
private static void ReportError(VCException e) { if (VCSettings.BugReport) { string title = Environment.UserName + "@" + Environment.MachineName + " : (" + VCUtility.GetCurrentVersion() + "):\n" + e.ErrorMessage; string description = "\n" + e.ErrorDetails; var conflicts = VCCommands.Instance.GetFilteredAssets( svnStatus => svnStatus.treeConflictStatus != VCTreeConflictStatus.Normal || svnStatus.fileStatus == VCFileStatus.Conflicted || svnStatus.fileStatus == VCFileStatus.Obstructed); if (conflicts != null && conflicts.Any()) description += "\n\nSVN Conflicts:\n" + conflicts.Select(status => status.assetPath.Compose()).Aggregate((a, b) => a + "\n" + b); FogbugzUtilities.SubmitAutoBug(title, description); } }