Protogame.DefaultErrorReport.Report C# (CSharp) Méthode

Report() public méthode

public Report ( Exception ex, bool exit = true ) : void
ex System.Exception
exit bool
Résultat void
        public void Report(Exception ex, bool exit = true)
        {
            _errorReportOutput.Report(ex);

            if (exit)
            {
                Environment.Exit(1);
            }
        }
    }

Usage Example

        public static void RunEarly(Action entryPoint)
        {
            if (Debugger.IsAttached)
            {
                entryPoint();
                return;
            }

            try
            {
                entryPoint();
            }
            catch (Exception ex)
            {
                // Very early on in game startup, we don't have the kernel fully initialized yet,
                // so we have to rely on builtin implementations without DI.
                IErrorReportOutput errorReportOutput;

#if PLATFORM_WINDOWS
                errorReportOutput = new WindowsFormsErrorReportOutput();
#elif PLATFORM_MACOS || PLATFORM_LINUX
                errorReportOutput = new ConsoleErrorReportOutput();
#else
                errorReportOutput = new NullErrorReportOutput();
#endif

                var errorReportFallback = new DefaultErrorReport(errorReportOutput);
                errorReportFallback.Report(ex);
            }
        }