datastax / astra-db-ts

Typescript client for Astra DB Vector
https://npmjs.com/@datastax/astra-db-ts
Apache License 2.0
13 stars 6 forks source link

throw readable error if passing endpoint and keyspace as a string to db() #55

Closed vkarpov15 closed 2 months ago

vkarpov15 commented 2 months ago

An error I ran into the other day while getting set up with this project: if you do client.db(endpoint, namespace) instead of client.db(endpoint, { namespace }) you get some unreadable dns errors. This PR adds better handling for that case.

vkarpov15 commented 2 months ago

@toptobes what do you think of the new error message? Unexpected db() argument: database id can\'t start with "https://". Did you mean to call .db(endpoint, { namespace })?