more descriptive error messages

This commit is contained in:
Adam D. Ruppe 2011-10-27 10:24:43 -04:00
parent 025e7ee835
commit 5a9b0bfda9
2 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,8 @@ struct Row {
package ResultSet resultSet;
string opIndex(size_t idx) {
if(idx >= row.length)
throw new Exception(text("index ", idx, " is out of bounds on result"));
return row[idx];
}

View File

@ -100,6 +100,8 @@ class MySqlResult : ResultSet {
private void fetchNext() {
assert(result);
auto r = mysql_fetch_row(result);
if(r is null)
throw new Exception("there is no next row");
uint numFields = mysql_num_fields(result);
uint* lengths = mysql_fetch_lengths(result);
string[] row;