Microsoft.VisualStudio.Project.IDEBuildLogger.CallWithErrorMessage C# (CSharp) Method

CallWithErrorMessage() private static method

Show error message if exception is caught when invoking a method
private static CallWithErrorMessage ( IServiceProvider serviceProvider, System.Action action ) : void
serviceProvider IServiceProvider service provider
action System.Action action to invoke
return void
        private static void CallWithErrorMessage(IServiceProvider serviceProvider, Action action)
        {
            try
            {
                action();
            }
            catch (Exception ex)
            {
                if (Microsoft.VisualStudio.ErrorHandler.IsCriticalException(ex))
                {
                    throw;
                }

                ShowErrorMessage(serviceProvider, ex);
            }
        }