@@ -134,12 +134,12 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
134
134
await _afterSchemaReady ();
135
135
}
136
136
137
- void _assertSchemaIsReady () {
137
+ void _checkSchemaIsReady () {
138
138
if (! manualSchemaManagement || _manualSchemaManagementCompleted) {
139
139
return ;
140
140
}
141
141
142
- throw AssertionError (
142
+ throw StateError (
143
143
'In manual schema management mode, you need to mark the powersync database as ready' );
144
144
}
145
145
@@ -319,7 +319,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
319
319
// the lock for the connection.
320
320
await initialize ();
321
321
322
- _assertSchemaIsReady ();
322
+ _checkSchemaIsReady ();
323
323
324
324
final resolvedOptions = ResolvedSyncOptions .resolve (
325
325
options,
@@ -484,15 +484,15 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
484
484
/// Get an unique id for this client.
485
485
/// This id is only reset when the database is deleted.
486
486
Future <String > getClientId () async {
487
- _assertSchemaIsReady (); // TODO(skilldevs): Needed?
487
+ _checkSchemaIsReady (); // TODO(skilldevs): Needed?
488
488
final row = await get ('SELECT powersync_client_id() as client_id' );
489
489
return row['client_id' ] as String ;
490
490
}
491
491
492
492
/// Get upload queue size estimate and count.
493
493
Future <UploadQueueStats > getUploadQueueStats (
494
494
{bool includeSize = false }) async {
495
- _assertSchemaIsReady ();
495
+ _checkSchemaIsReady ();
496
496
if (includeSize) {
497
497
final row = await getOptional (
498
498
'SELECT SUM(cast(data as blob) + 20) as size, count(*) as count FROM ps_crud' );
@@ -520,7 +520,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
520
520
/// data by transaction. One batch may contain data from multiple transactions,
521
521
/// and a single transaction may be split over multiple batches.
522
522
Future <CrudBatch ?> getCrudBatch ({int limit = 100 }) async {
523
- _assertSchemaIsReady ();
523
+ _checkSchemaIsReady ();
524
524
final rows = await getAll (
525
525
'SELECT id, tx_id, data FROM ps_crud ORDER BY id ASC LIMIT ?' ,
526
526
[limit + 1 ]);
@@ -567,7 +567,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
567
567
/// Unlike [getCrudBatch] , this only returns data from a single transaction at a time.
568
568
/// All data for the transaction is loaded into memory.
569
569
Future <CrudTransaction ?> getNextCrudTransaction () async {
570
- _assertSchemaIsReady ();
570
+ _checkSchemaIsReady ();
571
571
return await readTransaction ((tx) async {
572
572
final first = await tx.getOptional (
573
573
'SELECT id, tx_id, data FROM ps_crud ORDER BY id ASC LIMIT 1' );
0 commit comments