You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below you can find a more detailed explanation of some of the errors that can be encountered while using ftcsv. For parsing, examples of these files can be found in /spec/bad_csvs/
3
+
4
+
5
+
6
+
##Parsing
7
+
Note: `[row_number]` indicates the row number of the parsed lua table. As such, it will be one off from the line number in the csv. However, for header-less files, the row returned *will* match the csv line number.
8
+
9
+
| Error Message | Detailed Explanation |
10
+
| ------------- | ------------- |
11
+
| ftcsv: Cannot parse an empty file | The file passed in contains no information. It is an empty file. |
12
+
| ftcsv: Cannot parse a file which contains empty headers | If a header field contains no information, then it can't be parsed <br> (ex: `Name,City,,Zipcode`) |
13
+
| ftcsv: too few columns in row [row_number]| The number of columns is less than the amount in the header after transformations (renaming, keeping certain fields, etc) |
14
+
| ftcsv: too many columns in row [row_number]| The number of columns is greater than the amount in the header after transformations. It can't map the field's count with an existing header. |
15
+
| ftcsv: File not found at [path]| When loading, lua can't open the file at [path]|
Copy file name to clipboardexpand all lines: README.md
+6
Original file line number
Diff line number
Diff line change
@@ -117,8 +117,14 @@ I did some basic testing and found that in lua, if you want to iterate over a st
117
117
118
118
119
119
120
+
## Error Handling
121
+
ftcsv returns a litany of errors when passed a bad csv file or incorrect parameters. You can find a more detailed explanation of the more cryptic errors in [ERRORS.md](ERRORS.md)
122
+
123
+
124
+
120
125
## Contributing
121
126
Feel free to create a new issue for any bugs you've found or help you need. If you want to contribute back to the project please do the following:
127
+
0. If it's a major change (aka more than a quick little < 5 line bugfix), please create an issue so we can discuss it!
@@ -295,8 +316,8 @@ function ftcsv.parse(inputFile, delimiter, options)
295
316
fieldsToKeep[ofieldsToKeep[j]] =true
296
317
end
297
318
end
298
-
ifheader==falsethen
299
-
assert(next(rename) ~=nil, "ftcsv can only have fieldsToKeep for header-less files when they have been renamed. Please add the 'rename' option and try again.")
319
+
ifheader==falseandoptions.rename==nilthen
320
+
error("ftcsv: fieldsToKeep only works with header-less files when using the 'rename' functionality")
300
321
end
301
322
end
302
323
ifoptions.loadFromString~=nilthen
@@ -318,10 +339,22 @@ function ftcsv.parse(inputFile, delimiter, options)
0 commit comments