Upsilon/Upsilon/Exceptions/ParseException.cs

30 lines
827 B
C#

using System;
using Upsilon.Text;
namespace Upsilon.Exceptions
{
public class ParseException : Exception
{
public string FileName { get; }
public string ErrorMessage { get; }
public int Line { get; }
public int Character { get; }
public string ErrorLine { get; }
public ParseException(string fileName, string errorMessage, int line, int character, string errorLine)
{
FileName = fileName;
ErrorMessage = errorMessage;
Line = line;
Character = character;
ErrorLine = errorLine;
}
public override string ToString()
{
return $"[{FileName}] {ErrorMessage} at ({Line}, {Character})\n{ErrorLine}";
}
public override string Message => ToString();
}
}