@@ -155,7 +155,8 @@ extension ValueWriteOnlyObserver {
155
155
( self . notificationCallbacks, self . databaseAccess)
156
156
}
157
157
guard let notificationCallbacks = notificationCallbacksOpt, let writer = databaseAccessOpt? . writer else {
158
- // Likely a GRDB bug
158
+ // Likely a GRDB bug: during a synchronous start, user is not
159
+ // able to cancel observation.
159
160
fatalError ( " can't start a cancelled or failed observation " )
160
161
}
161
162
@@ -199,7 +200,8 @@ extension ValueWriteOnlyObserver {
199
200
try writer. unsafeReentrantWrite { db in
200
201
// Fetch & Start observing the database
201
202
guard let fetchedValue = try fetchAndStartObservation ( db) else {
202
- // Likely a GRDB bug
203
+ // Likely a GRDB bug: during a synchronous start, user is not
204
+ // able to cancel observation.
203
205
fatalError ( " can't start a cancelled or failed observation " )
204
206
}
205
207
@@ -259,6 +261,9 @@ extension ValueWriteOnlyObserver {
259
261
260
262
/// Fetches the initial value, and start observing the database.
261
263
///
264
+ /// Returns nil if the observation was cancelled before database observation
265
+ /// could start.
266
+ ///
262
267
/// By grouping the initial fetch and the beginning of observation in a
263
268
/// single database access, we are sure that no concurrent write can happen
264
269
/// during the initial fetch, and that we won't miss any future change.
0 commit comments