2015-07-19 15:51:10 -05:00
|
|
|
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; }
|
2018-09-25 16:29:53 -05:00
|
|
|
public int? ColNumber { get; private set; }
|
2015-07-19 15:51:10 -05:00
|
|
|
|
2018-09-25 16:29:53 -05:00
|
|
|
public FicdownException(string blockName, string message, int? lineNumber = null, int? colNumber = null) : base(message)
|
2015-07-19 15:51:10 -05:00
|
|
|
{
|
2015-07-24 00:56:53 -05:00
|
|
|
BlockName = blockName;
|
|
|
|
LineNumber = lineNumber;
|
2018-09-25 16:29:53 -05:00
|
|
|
ColNumber = colNumber;
|
2015-07-19 15:51:10 -05:00
|
|
|
}
|
|
|
|
|
2015-07-24 00:56:53 -05:00
|
|
|
public FicdownException(string message) : base(message) { }
|
2015-07-19 15:51:10 -05:00
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
2018-09-25 16:29:53 -05:00
|
|
|
return string.Format("Error L{0},{1}: {2}",
|
|
|
|
LineNumber ?? 1,
|
|
|
|
ColNumber ?? 1,
|
|
|
|
!string.IsNullOrEmpty(BlockName)
|
|
|
|
? string.Format("\"{0}\": {1}", BlockName, Message)
|
|
|
|
: Message);
|
2015-07-19 15:51:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|