Skip to content

Parsing errors were not being thrown correctly#77

Open
AdrianoFerrari wants to merge 7 commits intopouchdb-community:masterfrom
gingko:errors-from-ndjson
Open

Parsing errors were not being thrown correctly#77
AdrianoFerrari wants to merge 7 commits intopouchdb-community:masterfrom
gingko:errors-from-ndjson

Conversation

@AdrianoFerrari
Copy link
Copy Markdown
Member

Errors were only being thrown when present in the first and only line of the file. This was a critical issue, because it meant that an error in any multi-line file would fail to load, without any errors. In fact, the promise would neither reject or resolve.

(a note on Travis CI tests: http tests are failing simply because the tests were written for CouchDB 1.x, but fail on 2.x . seq is no longer a number, but a string, for instance).

Previously, the load promise would only be rejected if there was an
error in the *first* line of the file. Because in the tests there
was only one line, this wasn't picked up. Now errors from ndjson
are thrown correctly.
Tests were testing only the type 'error' but not the error message.
Chai's "should.be.a" takes two parameters: the type expected, and a
message to display if the types don't match. The second parameter
is *not* the expected error message.
@AdrianoFerrari
Copy link
Copy Markdown
Member Author

@oliviertassinari can you have a quick look at this?

There seems to have been an issue with the original changes you implemented. (you can see that it didn't throw an error if you passed in "foo\nbar" instead of just "foo" into the test).

I'd like another set of eyes on this before I contact nolan to try to get this merged.

@oliviertassinari
Copy link
Copy Markdown
Contributor

@AdrianoFerrari This was a long time ago. I have lost the context, sorry.

@AdrianoFerrari
Copy link
Copy Markdown
Member Author

Understood, thanks anyway 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants