Microsoft.Scripting.Hosting.ErrorListener.ErrorReported C# (CSharp) Method

ErrorReported() public abstract method

public abstract ErrorReported ( ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity ) : void
source ScriptSource
message string
span SourceSpan
errorCode int
severity Severity
return void
        public abstract void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity);

Usage Example

        public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity)
        {
            if (_listener != null)
            {
                ScriptSource scriptSource;
                if (sourceUnit != _source.SourceUnit)
                {
                    scriptSource = new ScriptSource(_source.Engine.Runtime.GetEngine(sourceUnit.LanguageContext), sourceUnit);
                }
                else
                {
                    scriptSource = _source;
                }

                _listener.ErrorReported(scriptSource, message, span, errorCode, severity);
            }
            else if (severity == Severity.FatalError || severity == Severity.Error)
            {
                throw new SyntaxErrorException(message, sourceUnit, span, errorCode, severity);
            }
        }