I would have a set of errors easily accessible in the parser, something like this:
public class Parser
{
public bool HasErrors {
get { return ParseErrors != null && ParseErrors.Count > 0; }
}
public List<string> ParseErrors { get; set; }
public object Parse(string fileName) {}
}
Or any type of error that you wanted, of course, something in more detail.
The code calling your library will look something like this:
var p = new Parser();
var o = p.Parse("file.txt");
if(p.HasErrors)
source
share