chore(core): added logs for key-change failure

This commit is contained in:
alina 🌸 2024-06-28 14:11:22 +03:00
parent 1b5760b3fc
commit c536086310
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -320,7 +320,10 @@ export class DcConnectionManager {
this.download.notifyKeyChange()
this.downloadSmall.notifyKeyChange()
})
.catch((e: Error) => this.manager.params.emitError(e))
.catch((e: Error) => {
this.manager._log.warn('failed to save auth key for dc %d: %s', this.dcId, e)
this.manager.params.emitError(e)
})
})
connection.on('tmp-key-change', (idx: number, key: Uint8Array | null, expires: number) => {
if (kind !== 'main') {
@ -342,7 +345,10 @@ export class DcConnectionManager {
this.download.notifyKeyChange()
this.downloadSmall.notifyKeyChange()
})
.catch((e: Error) => this.manager.params.emitError(e))
.catch((e: Error) => {
this.manager._log.warn('failed to save temp auth key %d for dc %d: %s', idx, this.dcId, e)
this.manager.params.emitError(e)
})
})
connection.on('future-salts', (salts: mtp.RawMt_future_salt[]) => {
Promise.resolve(this.manager._storage.salts.store(this.dcId, salts)).catch((e: Error) =>