Skip to content

Commit

Permalink
Update src/cloudflare/internal/vectorize-api.ts
Browse files Browse the repository at this point in the history
Review suggestion

Co-authored-by: Rahul Sethi <5822355+RamIdeas@users.noreply.github.com>
  • Loading branch information
garvit-gupta and RamIdeas committed Aug 15, 2024
1 parent 310ecf9 commit 538774b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cloudflare/internal/vectorize-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VectorizeIndexImpl implements Vectorize {
if (this.indexVersion === "v2") {
if (!isVectorizeMetadataRetrievalLevel(options?.returnMetadata) ) {
throw new Error(
`Invalid returnMetadata option. Expected: "none", "indexed" or "all"; got: ${options.returnMetadata}`
`Invalid returnMetadata option. Expected: "none", "indexed" or "all"; got: ${options?.returnMetadata}`
);
}
const res = await this._send(Operation.VECTOR_QUERY, `query`, {
Expand All @@ -64,9 +64,9 @@ class VectorizeIndexImpl implements Vectorize {

return await toJson<VectorizeMatches>(res);
} else {
if (options && options.returnMetadata && typeof options.returnMetadata !== 'boolean') {
if (typeof options?.returnMetadata !== 'boolean') {
throw new Error(
`Invalid returnMetadata option. Expected boolean; got: ${options.returnMetadata}`
`Invalid returnMetadata option. Expected boolean; got: ${options?.returnMetadata}`
);
}
const compat = {
Expand Down

0 comments on commit 538774b

Please sign in to comment.