Skip to content

Commit daec553

Browse files
committed
fix(Default): Catch throttledCb cancelled error
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent abd1fbd commit daec553

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/lib/strategies/Default.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ export default class SyncProcess {
181181
0.5 + (this.actionsDone / (this.actionsPlanned + 1)) * 0.5
182182
),
183183
this.actionsDone
184-
)
184+
).catch((er) => {
185+
if (er instanceof CanceledError) {
186+
return
187+
}
188+
throw er
189+
})
185190
}
186191

187192
setDirection(direction:TItemLocation):void {
@@ -190,13 +195,23 @@ export default class SyncProcess {
190195

191196
async sync(): Promise<void> {
192197
// onSyncStart is already executed at this point
193-
this.progressCb(0.15, 0)
198+
this.progressCb(0.15, 0).catch((er) => {
199+
if (er instanceof CanceledError) {
200+
return
201+
}
202+
throw er
203+
})
194204

195205
this.masterLocation = ItemLocation.LOCAL
196206
await this.prepareSync()
197207

198208
// trees are loaded at this point
199-
this.progressCb(0.35, 0)
209+
this.progressCb(0.35, 0).catch((er) => {
210+
if (er instanceof CanceledError) {
211+
return
212+
}
213+
throw er
214+
})
200215

201216
if (this.canceled) {
202217
throw new CancelledSyncError()
@@ -209,7 +224,12 @@ export default class SyncProcess {
209224
Logger.log({ localScanResult, serverScanResult })
210225
this.localScanResult = localScanResult
211226
this.serverScanResult = serverScanResult
212-
this.progressCb(0.45, 0)
227+
this.progressCb(0.45, 0).catch((er) => {
228+
if (er instanceof CanceledError) {
229+
return
230+
}
231+
throw er
232+
})
213233
}
214234

215235
if (this.canceled) {

0 commit comments

Comments
 (0)