Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 8049fdf

Browse files
Update collections example (#162)
1 parent ea96807 commit 8049fdf

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Add namespace support for collections [#158](https://github.com/hypermodeAI/functions-as/pull/158)
77
- Add getNamespaces host function to collections [#160](https://github.com/hypermodeAI/functions-as/pull/160)
88
- Add cross namespace search support to collections [#161](https://github.com/hypermodeAI/functions-as/pull/161)
9+
- Update collections example [#162](https://github.com/hypermodeAI/functions-as/pull/162)
910

1011
## 2024-08-01 - Version 0.10.5
1112

examples/collection/assembly/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,16 @@ export function embed(text: string[]): f32[][] {
1717

1818
export function addProduct(description: string): string[] {
1919
const response = collections.upsert(myProducts, null, description);
20-
if (!response.isSuccessful) {
21-
throw new Error(response.error);
22-
}
2320
return response.keys;
2421
}
2522

2623
export function addProducts(descriptions: string[]): string[] {
2724
const response = collections.upsertBatch(myProducts, [], descriptions);
28-
if (!response.isSuccessful) {
29-
throw new Error(response.error);
30-
}
3125
return response.keys;
3226
}
3327

3428
export function deleteProduct(key: string): string {
3529
const response = collections.remove(myProducts, key);
36-
if (!response.isSuccessful) {
37-
throw new Error(response.error);
38-
}
3930
return response.status;
4031
}
4132

0 commit comments

Comments
 (0)