Skip to content

fix(documents): throw on empty lists of documents#262

Merged
jasonbosco merged 2 commits into
typesense:masterfrom
tharropoulos:throw-on-empty-docs
Feb 6, 2025
Merged

fix(documents): throw on empty lists of documents#262
jasonbosco merged 2 commits into
typesense:masterfrom
tharropoulos:throw-on-empty-docs

Conversation

@tharropoulos
Copy link
Copy Markdown
Collaborator

TDLR

Addresses #188

Change Summary

This pull request introduces a new error handling mechanism in the Documents class within the src/Typesense/Documents.ts file. The main changes include the addition of a new error type and checks to ensure that provided documents are not empty.

Error handling improvements:

Utility function addition:

PR Checklist

Copy link
Copy Markdown
Member

@jasonbosco jasonbosco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a unit test for this?

- add test for empty array input
- add test for empty string input
- add test for null input
- add test for undefined input
@tharropoulos
Copy link
Copy Markdown
Collaborator Author

Could you add a unit test for this?

Added tests in 3a55318

@jasonbosco jasonbosco merged commit 066349d into typesense:master Feb 6, 2025
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