public static Throw ( String message, |
||
message | String | Message to show to the user |
inner | The exception that was thrown/raised | |
canReport | bool | If the crash should be allowed to be reported to Bugsense |
return | 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();
}
CrashHandler::Throw ( String message, bool canReport = true ) : void |
/// <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); } }