Exemplo n.º 1
0
 public ErrorDetails(EnvironmentDetails environmentDetails, ExceptionHandlingDetails exceptionHandlingDetails, ExceptionDetails exceptionDetails, string faultingContextDetails, string programName)
 {
     EnvironmentDetails       = environmentDetails;
     ExceptionHandlingDetails = exceptionHandlingDetails;
     ExceptionDetails         = exceptionDetails;
     FaultingContextDetails   = faultingContextDetails;
     ProgramName = programName;
 }
Exemplo n.º 2
0
        private void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            var result = MessageBox.Show(
                "Oh oh oh. Unhandled exception has occured. Would you like to continue program execution anyway?",
                "Unhandled exception has occured",
                MessageBoxButtons.YesNo);

            var continueExecution = result == DialogResult.Yes;

            var handlingDetails = new ExceptionHandlingDetails(true, continueExecution);

            SendErrorDetails("Exception occured on UI thread", e.Exception, handlingDetails);

            if (!continueExecution)
            {
                Environment.Exit(-1);
            }
        }
Exemplo n.º 3
0
 private static ErrorDetails CreateErrorDetails(string faultingContextDetails, Exception exception, ExceptionHandlingDetails exceptionHandlingDetails) =>
 new ErrorDetails(
     GetEnvironmentDetails(),
     exceptionHandlingDetails,
     new ExceptionDetails(exception),
     faultingContextDetails,
     Assembly.GetExecutingAssembly().GetName().Name
     );
Exemplo n.º 4
0
        private void SendErrorDetails(string faultingContextDetails, Exception exception, ExceptionHandlingDetails exceptionHandlingDetails)
        {
            var details = CreateErrorDetails(faultingContextDetails, exception, exceptionHandlingDetails);

            var json    = JsonConvert.SerializeObject(details, Formatting.Indented);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            _httpClient.PostAsync("api/error-details", content).Wait(TimeSpan.FromSeconds(MaxResponseWaitTimeSec));
        }
Exemplo n.º 5
0
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var handlingDetails = new ExceptionHandlingDetails(false, false);

            SendErrorDetails("Unhandled exception occured", e.ExceptionObject as Exception, handlingDetails);
        }