@@ -86,6 +86,10 @@ impl PowerSyncError {
8686 RawPowerSyncError :: MissingClientId . into ( )
8787 }
8888
89+ pub fn down_migration_did_not_update_version ( current_version : i32 ) -> Self {
90+ return RawPowerSyncError :: DownMigrationDidNotUpdateVersion { current_version } . into ( ) ;
91+ }
92+
8993 /// Applies this error to a function result context, setting the error code and a descriptive
9094 /// text.
9195 pub fn apply_to_ctx ( self , description : & str , ctx : * mut context ) {
@@ -115,7 +119,9 @@ impl PowerSyncError {
115119 match self . inner . as_ref ( ) {
116120 Sqlite { code, .. } => * code,
117121 ArgumentError { .. } | StateError { .. } => ResultCode :: MISUSE ,
118- MissingClientId | SyncProtocolError { .. } => ResultCode :: ABORT ,
122+ MissingClientId
123+ | SyncProtocolError { .. }
124+ | DownMigrationDidNotUpdateVersion { .. } => ResultCode :: ABORT ,
119125 LocalDataError { .. } => ResultCode :: CORRUPT ,
120126 Internal { .. } => ResultCode :: INTERNAL ,
121127 }
@@ -192,6 +198,8 @@ enum RawPowerSyncError {
192198 LocalDataError { cause : PowerSyncErrorCause } ,
193199 #[ error( "No client_id found in ps_kv" ) ]
194200 MissingClientId ,
201+ #[ error( "Down migration failed - version not updated from {current_version}" ) ]
202+ DownMigrationDidNotUpdateVersion { current_version : i32 } ,
195203 /// A catch-all for remaining internal errors that are very unlikely to happen.
196204 #[ error( "Internal PowerSync error. {cause}" ) ]
197205 Internal { cause : PowerSyncErrorCause } ,
0 commit comments