Skip to content

Commit

Permalink
Get the library version when a ParsingException happens
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyah committed Jun 6, 2015
1 parent 13b5880 commit e7290ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/IniFileParser/Exceptions/ParsingException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace IniParser.Exceptions
/// </summary>
public class ParsingException : Exception
{
public Version LibVersion {get; private set;}
public int LineNumber {get; private set;}
public string LineValue {get; private set;}

Expand All @@ -23,8 +24,13 @@ public ParsingException(string msg, int lineNumber, string lineValue)
{}

public ParsingException(string msg, int lineNumber, string lineValue, Exception innerException)
: base(string.Format("Error \'{2}\' while parsing line {1}: \'{0}\'", lineValue, lineNumber, msg), innerException)
: base(
string.Format(
"{0} while parsing line number {1} with value \'{2}\' - IniParser version: {3}",
msg, lineNumber, lineValue, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version),
innerException)
{
LibVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
LineNumber = lineNumber;
LineValue = lineValue;
}
Expand Down

0 comments on commit e7290ab

Please sign in to comment.