mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-02-08 18:48:18 +01:00
dont need extra log depth
This commit is contained in:
parent
f46d2c1bf5
commit
1f8a591cf6
@ -200,40 +200,38 @@ export class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _createSessionAfterAuth({deviceId, userId, accessToken, homeserver}, inspectAccountSetup, log) {
|
async _createSessionAfterAuth({deviceId, userId, accessToken, homeserver}, inspectAccountSetup, log) {
|
||||||
await log.wrap("_createSessionAfterAuth", async (l) => {
|
const id = this.createNewSessionId();
|
||||||
const id = this.createNewSessionId();
|
const lastUsed = this._platform.clock.now();
|
||||||
const lastUsed = this._platform.clock.now();
|
const sessionInfo = {
|
||||||
const sessionInfo = {
|
id,
|
||||||
id,
|
deviceId,
|
||||||
deviceId,
|
userId,
|
||||||
userId,
|
homeServer: homeserver, // deprecate this over time
|
||||||
homeServer: homeserver, // deprecate this over time
|
homeserver,
|
||||||
homeserver,
|
accessToken,
|
||||||
accessToken,
|
lastUsed,
|
||||||
lastUsed,
|
};
|
||||||
};
|
let dehydratedDevice;
|
||||||
let dehydratedDevice;
|
if (inspectAccountSetup) {
|
||||||
if (inspectAccountSetup) {
|
dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, log);
|
||||||
dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, l);
|
if (dehydratedDevice) {
|
||||||
if (dehydratedDevice) {
|
sessionInfo.deviceId = dehydratedDevice.deviceId;
|
||||||
sessionInfo.deviceId = dehydratedDevice.deviceId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await this._platform.sessionInfoStorage.add(sessionInfo);
|
}
|
||||||
// loading the session can only lead to
|
await this._platform.sessionInfoStorage.add(sessionInfo);
|
||||||
// LoadStatus.Error in case of an error,
|
// loading the session can only lead to
|
||||||
// so separate try/catch
|
// LoadStatus.Error in case of an error,
|
||||||
try {
|
// so separate try/catch
|
||||||
await this._loadSessionInfo(sessionInfo, dehydratedDevice, l);
|
try {
|
||||||
l.set("status", this._status.get());
|
await this._loadSessionInfo(sessionInfo, dehydratedDevice, log);
|
||||||
} catch (err) {
|
log.set("status", this._status.get());
|
||||||
l.catch(err);
|
} catch (err) {
|
||||||
// free olm Account that might be contained
|
log.catch(err);
|
||||||
dehydratedDevice?.dispose();
|
// free olm Account that might be contained
|
||||||
this._error = err;
|
dehydratedDevice?.dispose();
|
||||||
this._status.set(LoadStatus.Error);
|
this._error = err;
|
||||||
}
|
this._status.set(LoadStatus.Error);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _loadSessionInfo(sessionInfo, dehydratedDevice, log) {
|
async _loadSessionInfo(sessionInfo, dehydratedDevice, log) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user