SDownload.Framework.CrashHandler.Throw C# (CSharp) 메소드

Throw() 공개 정적인 메소드

Reports an error to the user, and provides the option to report if the crash is critical enough
public static Throw ( String message, Exception inner, bool canReport = true ) : void
message String Message to show to the user
inner System.Exception The exception that was thrown/raised
canReport bool If the crash should be allowed to be reported to Bugsense
리턴 void
        public static void Throw(String message, Exception inner, bool canReport = true)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            var handled = inner as HandledException;
            var criticalHandled = handled != null && handled.IsCritical;
            // Use the exception message if it is of type HandledException or a message wasn't passed through
            // If it is a HandledException, only provide the option to report if the exception is critical
            var dialog = new YesNoDialog("ERROR:\n" + (handled != null ? inner.Message : (message ?? inner.Message)),
                (handled == null && canReport) || criticalHandled ? "Report" : "Close",
                (handled == null && canReport) || criticalHandled ? "Close" : null)
            {
                ResponseCallback = result =>
                {
                    // Log exception only if 'Report' was chosen, and the exception was critical
                    if (result && canReport)
                        BugSenseHandler.Instance.SendExceptionAsync(inner);
                    ClearExtras();
                }
            };
            dialog.Show();
        }

Same methods

CrashHandler::Throw ( String message, bool canReport = true ) : void

Usage Example

예제 #1
0
 /// <summary>
 /// Sends a string to the remote websocket client
 /// passing in default values for the second and third param
 /// </summary>
 /// <param name="info">The information to send</param>
 private void WSReport(String info)
 {
     try
     {
         Context.Send(info);
     }
     catch (Exception e)
     {
         CrashHandler.Throw("There was an issue communicating with the UI!", e);
     }
 }
All Usage Examples Of SDownload.Framework.CrashHandler::Throw