Antlr4.Build.Tasks.Antlr4ClassGenerationTask.IsFatalException C# (CSharp) Method

IsFatalException() static private method

static private IsFatalException ( Exception exception ) : bool
exception System.Exception
return bool
        internal static bool IsFatalException(Exception exception)
        {
            while (exception != null)
            {
                if (exception is OutOfMemoryException)
                {
                    return true;
                }

                if (!(exception is TypeInitializationException) && !(exception is TargetInvocationException))
                {
                    break;
                }

                exception = exception.InnerException;
            }

            return false;
        }
    }

Usage Example

        private void HandleOutputDataReceived(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return;
            }

            try
            {
                Match match = GeneratedFileMessageFormat.Match(data);
                if (!match.Success)
                {
                    _buildMessages.Add(new BuildMessage(data));
                    return;
                }

                string fileName = match.Groups["OUTPUT"].Value;
                if (LanguageSourceExtensions.Contains(Path.GetExtension(fileName), StringComparer.OrdinalIgnoreCase))
                {
                    GeneratedCodeFiles.Add(match.Groups["OUTPUT"].Value);
                }
            }
            catch (Exception ex)
            {
                if (Antlr4ClassGenerationTask.IsFatalException(ex))
                {
                    throw;
                }

                _buildMessages.Add(new BuildMessage(ex.Message));
            }
        }
All Usage Examples Of Antlr4.Build.Tasks.Antlr4ClassGenerationTask::IsFatalException