@@ -134,12 +134,12 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
134134 await _afterSchemaReady ();
135135 }
136136
137- void _assertSchemaIsReady () {
137+ void _checkSchemaIsReady () {
138138 if (! manualSchemaManagement || _manualSchemaManagementCompleted) {
139139 return ;
140140 }
141141
142- throw AssertionError (
142+ throw StateError (
143143 'In manual schema management mode, you need to mark the powersync database as ready' );
144144 }
145145
@@ -319,7 +319,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
319319 // the lock for the connection.
320320 await initialize ();
321321
322- _assertSchemaIsReady ();
322+ _checkSchemaIsReady ();
323323
324324 final resolvedOptions = ResolvedSyncOptions .resolve (
325325 options,
@@ -484,15 +484,15 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
484484 /// Get an unique id for this client.
485485 /// This id is only reset when the database is deleted.
486486 Future <String > getClientId () async {
487- _assertSchemaIsReady (); // TODO(skilldevs): Needed?
487+ _checkSchemaIsReady (); // TODO(skilldevs): Needed?
488488 final row = await get ('SELECT powersync_client_id() as client_id' );
489489 return row['client_id' ] as String ;
490490 }
491491
492492 /// Get upload queue size estimate and count.
493493 Future <UploadQueueStats > getUploadQueueStats (
494494 {bool includeSize = false }) async {
495- _assertSchemaIsReady ();
495+ _checkSchemaIsReady ();
496496 if (includeSize) {
497497 final row = await getOptional (
498498 'SELECT SUM(cast(data as blob) + 20) as size, count(*) as count FROM ps_crud' );
@@ -520,7 +520,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
520520 /// data by transaction. One batch may contain data from multiple transactions,
521521 /// and a single transaction may be split over multiple batches.
522522 Future <CrudBatch ?> getCrudBatch ({int limit = 100 }) async {
523- _assertSchemaIsReady ();
523+ _checkSchemaIsReady ();
524524 final rows = await getAll (
525525 'SELECT id, tx_id, data FROM ps_crud ORDER BY id ASC LIMIT ?' ,
526526 [limit + 1 ]);
@@ -567,7 +567,7 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
567567 /// Unlike [getCrudBatch] , this only returns data from a single transaction at a time.
568568 /// All data for the transaction is loaded into memory.
569569 Future <CrudTransaction ?> getNextCrudTransaction () async {
570- _assertSchemaIsReady ();
570+ _checkSchemaIsReady ();
571571 return await readTransaction ((tx) async {
572572 final first = await tx.getOptional (
573573 'SELECT id, tx_id, data FROM ps_crud ORDER BY id ASC LIMIT 1' );
0 commit comments