CSVException

Exception containing the row and column for when an exception was thrown.

Numbering of both row and col start at one and corresponds to the location in the file rather than any specified header. Special consideration should be made when there is failure to match the header see HeaderMismatchException for details.

When performing type conversions, std.conv.ConvException is stored in the next field.

class CSVException : Exception {}

Members

Variables

col
size_t col;
row
size_t row;

Examples

import std.exception : collectException;
import std.algorithm.searching : count;
string text = "a,b,c\nHello,65";
auto ex = collectException!CSVException(csvReader(text).count);
assert(ex.toString == "(Row: 0, Col: 0) Row 2's length 2 does not match previous length of 3.");
import std.exception : collectException;
import std.algorithm.searching : count;
import std.typecons : Tuple;
string text = "a,b\nHello,65";
auto ex = collectException!CSVException(csvReader!(Tuple!(string,int))(text).count);
assert(ex.toString == "(Row: 1, Col: 2) Unexpected 'b' when converting from type string to type int");

Meta