ficdown/Ficdown.Parser/Model/Parser/FicdownException.cs

31 lines
941 B
C#
Raw Normal View History

namespace Ficdown.Parser.Model.Parser
{
using System;
public class FicdownException : Exception
{
2015-07-24 00:56:53 -05:00
public string BlockName { get; private set; }
public int? LineNumber { get; private set; }
public int? ColNumber { get; private set; }
public FicdownException(string blockName, string message, int? lineNumber = null, int? colNumber = null) : base(message)
{
2015-07-24 00:56:53 -05:00
BlockName = blockName;
LineNumber = lineNumber;
ColNumber = colNumber;
}
2015-07-24 00:56:53 -05:00
public FicdownException(string message) : base(message) { }
public override string ToString()
{
return string.Format("Error L{0},{1}: {2}",
LineNumber ?? 1,
ColNumber ?? 1,
!string.IsNullOrEmpty(BlockName)
? string.Format("\"{0}\": {1}", BlockName, Message)
: Message);
}
}
}