Skip to content

Commit

Permalink
Provide both of Exceptions constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseKPhillips committed Jan 30, 2012
1 parent 3891c39 commit 53fb29b
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions std/csv.d
Expand Up @@ -110,8 +110,14 @@ class CSVException : Exception
super(msg, file, line);
}

this(string msg, size_t row, size_t col, string file = __FILE__,
size_t line = __LINE__, Throwable next = null)
this(string msg, Throwable next, string file = __FILE__,
size_t line = __LINE__)
{
super(msg, file, line, next);
}

this(string msg, size_t row, size_t col, Throwable next = null,
string file = __FILE__, size_t line = __LINE__)
{
super(msg, next, file, line);
this.row = row;
Expand Down Expand Up @@ -142,6 +148,11 @@ class IncompleteCellException : CSVException
{
super(msg, file, line);
}

this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line, next);
}
}

/**
Expand All @@ -162,14 +173,19 @@ class IncompleteCellException : CSVException
* Since a row and column is not meaningful when a column specified by the
* header is not found in the data, both row and col will be zero. Otherwise
* row is always one and col is the first instance found in header that
* occurred before the previous starting an one.
* occurred before the previous starting at one.
*/
class HeaderMismatchException : CSVException
{
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{
super(msg, file, line);
}

this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line, next);
}
}

/**
Expand Down Expand Up @@ -987,8 +1003,7 @@ public:
}
catch(ConvException e)
{
throw new CSVException(e.msg, _input.row, _input.col,
__FILE__, __LINE__, e);
throw new CSVException(e.msg, _input.row, _input.col, e);
}

recordContent = aa;
Expand Down Expand Up @@ -1029,8 +1044,7 @@ public:
}
catch(ConvException e)
{
throw new CSVException(e.msg, _input.row, colIndex,
__FILE__, __LINE__, e);
throw new CSVException(e.msg, _input.row, colIndex, e);
}
}
}
Expand Down Expand Up @@ -1209,7 +1223,7 @@ public:
}
catch(ConvException e)
{
throw new CSVException(e.msg, _input.row, _input.col, __FILE__, __LINE__, e);
throw new CSVException(e.msg, _input.row, _input.col, e);
}
}
}
Expand Down Expand Up @@ -1247,7 +1261,7 @@ public:
try curContentsoken = to!Contents(_front.data);
catch(ConvException e)
{
throw new CSVException(e.msg, _input.row, _input.col, __FILE__, __LINE__, e);
throw new CSVException(e.msg, _input.row, _input.col, e);
}
}
}
Expand Down

0 comments on commit 53fb29b

Please sign in to comment.