File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 71
71
" encrypt-data" ,
72
72
" react" ,
73
73
" faq" ,
74
+ " upgrading" ,
74
75
" how-it-works" ,
75
76
" known-issues" ,
76
77
" indexers" ,
117
118
"apiHost" : " https://a.polybase.xyz"
118
119
}
119
120
}
120
- }
121
+ }
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " Upgrading to v0.6.0"
3
+ ---
4
+
5
+ For a full list of changes, please refer to the [ CHANGELOG] ( https://polybase.xyz/changelog ) .
6
+
7
+ ## Record not found, no longer errors
8
+
9
+ The Polybase client ` @polybase/client ` no longer throws an error if a record is not found. Polybase now always returns a CollectionRecordResponse.
10
+
11
+ If the record does not exist, the ` .data ` property will be ` null ` . You can call also use the helper method ` .exists() ` to check if the record exists.
12
+
13
+ ### Before
14
+
15
+ You had to capture the error and check if it was a ` PolybaseError ` and if the reason was ` record/not-found ` .
16
+
17
+ ``` js
18
+ const userData = await polybase .collection < User> (' User' ).record (publicKey).get ()
19
+ .catch (async (err ) => {
20
+ // Previously, you would get an error if the record did not exist
21
+ if (err && err instanceof PolybaseError && err .reason === ' record/not-found' ) {
22
+ // Record does not exist
23
+ return null
24
+ }
25
+ throw err
26
+ })
27
+ ```
28
+
29
+ ### After
30
+
31
+ Polybase client will not error on record not found. Instead, ` .data ` property will be null.
32
+
33
+ ``` js
34
+ // userData will always return a CollectionRecordResponse (even if record does not exist)
35
+ const userData = await polybase .collection < User> (' User' ).record (publicKey).get ()
36
+
37
+ // Check if the record exists
38
+ const exists = userData .exists ()
39
+
40
+ // Or check if the data is null
41
+ const exists = userData .data === null
42
+ ```
You can’t perform that action at this time.
0 commit comments