@@ -86,6 +86,10 @@ impl PowerSyncError {
86
86
RawPowerSyncError :: MissingClientId . into ( )
87
87
}
88
88
89
+ pub fn down_migration_did_not_update_version ( current_version : i32 ) -> Self {
90
+ return RawPowerSyncError :: DownMigrationDidNotUpdateVersion { current_version } . into ( ) ;
91
+ }
92
+
89
93
/// Applies this error to a function result context, setting the error code and a descriptive
90
94
/// text.
91
95
pub fn apply_to_ctx ( self , description : & str , ctx : * mut context ) {
@@ -115,7 +119,9 @@ impl PowerSyncError {
115
119
match self . inner . as_ref ( ) {
116
120
Sqlite { code, .. } => * code,
117
121
ArgumentError { .. } | StateError { .. } => ResultCode :: MISUSE ,
118
- MissingClientId | SyncProtocolError { .. } => ResultCode :: ABORT ,
122
+ MissingClientId
123
+ | SyncProtocolError { .. }
124
+ | DownMigrationDidNotUpdateVersion { .. } => ResultCode :: ABORT ,
119
125
LocalDataError { .. } => ResultCode :: CORRUPT ,
120
126
Internal { .. } => ResultCode :: INTERNAL ,
121
127
}
@@ -192,6 +198,8 @@ enum RawPowerSyncError {
192
198
LocalDataError { cause : PowerSyncErrorCause } ,
193
199
#[ error( "No client_id found in ps_kv" ) ]
194
200
MissingClientId ,
201
+ #[ error( "Down migration failed - version not updated from {current_version}" ) ]
202
+ DownMigrationDidNotUpdateVersion { current_version : i32 } ,
195
203
/// A catch-all for remaining internal errors that are very unlikely to happen.
196
204
#[ error( "Internal PowerSync error. {cause}" ) ]
197
205
Internal { cause : PowerSyncErrorCause } ,
0 commit comments