Skip to content

Commit

Permalink
Document parse error, closes #78
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Nov 21, 2023
1 parent 0b23904 commit 3b2e2f7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/nimble_csv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ defmodule NimbleCSV do
@doc """
Eagerly parses CSV from an enumerable and returns a list of rows.
Raises `NimbleCSV.ParseError` for an invalid CSV.
## Options
* `:skip_headers` - when `true`, skips headers. Defaults to `true`.
Expand All @@ -131,6 +133,8 @@ defmodule NimbleCSV do
entry in the enumerable is a line. If your stream does not conform
to that, you can call `c:to_line_stream/1` before parsing the stream.
Raises `NimbleCSV.ParseError` for an invalid CSV.
## Options
* `:skip_headers` - when `true`, skips headers. Defaults to `true`.
Expand All @@ -147,6 +151,8 @@ defmodule NimbleCSV do
@doc """
Eagerly parses CSV from a string and returns a list of rows.
Raises `NimbleCSV.ParseError` for an invalid CSV.
## Options
* `:skip_headers` - when `true`, skips headers. Defaults to `true`.
Expand Down Expand Up @@ -651,7 +657,13 @@ defmodule NimbleCSV do
case :binary.match(entry, check) do
{_, _} ->
replaced = :binary.replace(entry, @escape, @replacement, [:global])
[@encoded_escape, maybe_escape_formulas(entry), maybe_to_encoding(replaced), @encoded_escape]

[
@encoded_escape,
maybe_escape_formulas(entry),
maybe_to_encoding(replaced),
@encoded_escape
]

:nomatch ->
[maybe_escape_formulas(entry), maybe_to_encoding(entry)]
Expand Down

0 comments on commit 3b2e2f7

Please sign in to comment.