private static string CreateMessage(CommandFileLine first, CommandFileLine second) { string firstDecl = "First Declaration:" + Environment.NewLine + "\t" + first.Line + ":: " + first.Content + Environment.NewLine; string secondDecl = "Second Declaration:" + Environment.NewLine + "\t" + second.Line + ":: " + second.Content + Environment.NewLine; return(firstDecl + Environment.NewLine + secondDecl); }
private static string CreateMessage(CommandFileLine line, Exception innerException) { string position = "An error occured at line " + line.Line + " in " + line.Parent.FileName + ":"; if (innerException != null) { position = innerException.GetType().Name + " occured at Line " + line.Line + " in " + line.Parent.FileName + ":"; } string code = (line.Line - 1) + "::" + line.Before.Content + Environment.NewLine + line.Line + ":: " + line.Content + Environment.NewLine + (line.Line + 1) + "::" + line.After.Content; if (innerException != null) { string exception = Environment.NewLine + innerException.Message; return(position + Environment.NewLine + code + Environment.NewLine + exception); } return(position + Environment.NewLine + code); }
public MultipleDeclarationException(CommandFileLine first, CommandFileLine second) : base(CreateMessage(first, second)) { }
public PositionException(CommandFileLine position, Exception innerException) : base(CreateMessage(position, innerException), innerException) { }