Skip to content

Commit

Permalink
Last MR change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Heiber committed Mar 1, 2020
1 parent b5f90d3 commit afe6c82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion csv/src/fs2/data/csv/internals/CsvRowParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ private[csv] object CsvRowParser {
Header(firstRow) match {
case Left(error) => Pull.raiseError[F](error)
case Right(headers) if headers.length =!= firstRow.length =>
Pull.raiseError[F](new HeaderError("The count of headers must match the count of columns"))
val error = new HeaderError(
s"Got ${headers.length} headers, but ${firstRow.length} columns. Both numbers must match!")
Pull.raiseError[F](error)
case Right(headers) => tail.map(CsvRow[Header](_, headers)).pull.echo
}
case None => Pull.done
Expand Down
2 changes: 1 addition & 1 deletion csv/src/fs2/data/csv/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ package object csv {
def noHeaders[F[_]]: Pipe[F, NonEmptyList[String], Row] =
_.map(new Row(_))

/** Transforms a stream of raw CSV rows into rows, skipping the first line to ignore the headers. */
/** Transforms a stream of raw CSV rows into rows, skipping the first row to ignore the headers. */
def skipHeaders[F[_]]: Pipe[F, NonEmptyList[String], Row] =
_.tail.map(new Row(_))

Expand Down

0 comments on commit afe6c82

Please sign in to comment.