We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnexpectedEndOfRow
When multiple columns are missing, sv will create an UnexpectedEndOfRow error for each row that is missing, example:
sv
> decode ((,) <$> int <*> int) (Identity mempty) Failure (DecodeErrors (UnexpectedEndOfRow :| [UnexpectedEndOfRow]))
Here we wanted two int fields, but the given csv had zero (mempty :: Vector s) fields, so there’s two UEOR errors.
int
mempty :: Vector s
When pretty printing, usually the user wants to know how many rows were missing.
Here is a mockup of how they can be counted:
-- Pretties DecdodeErrors, but counts all UnexpectedEndOfRow errors so we can display how many rows were missing. prettyDecodeErrors errs = errs & foldMap1 ( \case Dec.UnexpectedEndOfRow -> (Sum 1, singleton Dec.UnexpectedEndOfRow) err -> (Sum 0, singleton err) ) & \case (Sum 0, errs') -> errs' & fmap (prettyDecodeError 0) (Sum n, errs') -> errs' & NonEmpty.nubBy (\a b -> a == Dec.UnexpectedEndOfRow && b == Dec.UnexpectedEndOfRow) & fmap (prettyDecodeError n) prettyDecodeError missingRows = \case Dec.UnexpectedEndOfRow -> [fmt|"Unexpected end of line, requires more {show missingRows} more rows"|] Dec.ExpectedEndOfRow fields -> "Extra unknown fields: " <> (fmap bytesToTextUtf8Lenient fields & show & stringToText) Dec.MissingColumn c -> "Missing column: " <> bytesToTextUtf8Lenient c Dec.BadDecode err -> "Decode error: " <> bytesToTextUtf8Lenient err other -> "Unknown decode error: " <> (other & show & stringToText)
The text was updated successfully, but these errors were encountered:
Note: I confused rows and columns again, of course it’s missing columns, not rows.
Sorry, something went wrong.
No branches or pull requests
When multiple columns are missing,
sv
will create anUnexpectedEndOfRow
error for each row that is missing, example:Here we wanted two
int
fields, but the given csv had zero (mempty :: Vector s
) fields, so there’s two UEOR errors.When pretty printing, usually the user wants to know how many rows were missing.
Here is a mockup of how they can be counted:
The text was updated successfully, but these errors were encountered: