Files
codeql/csharp/extractor/Semmle.Extraction/InternalError.cs
2018-10-10 14:40:52 +01:00

35 lines
1.1 KiB
C#

using Semmle.Util.Logging;
using Microsoft.CodeAnalysis;
using System;
namespace Semmle.Extraction
{
/// <summary>
/// Exception thrown whenever extraction encounters something unexpected.
/// </summary>
public class InternalError : Exception
{
public InternalError(ISymbol symbol, string msg, params object[] args)
{
ExtractionMessage = new Message { exception = this, symbol = symbol, severity = Severity.Error, message = string.Format(msg, args) };
}
public InternalError(SyntaxNode node, string msg, params object[] args)
{
ExtractionMessage = new Message { exception = this, node = node, severity = Severity.Error, message = string.Format(msg, args) };
}
public InternalError(string msg, params object[] args)
{
ExtractionMessage = new Message { exception = this, severity = Severity.Error, message = string.Format(msg, args) };
}
public Message ExtractionMessage
{
get; private set;
}
public override string Message => ExtractionMessage.message;
}
}