forked from mystiq/hydrogen-web
use canonical way of check error type
This commit is contained in:
parent
b852feeb9c
commit
ba38ce7976
1 changed files with 3 additions and 4 deletions
|
@ -21,7 +21,6 @@ import {Reconnector, ConnectionStatus} from "./net/Reconnector.js";
|
|||
import {ExponentialRetryDelay} from "./net/ExponentialRetryDelay.js";
|
||||
import {MediaRepository} from "./net/MediaRepository.js";
|
||||
import {RequestScheduler} from "./net/RequestScheduler.js";
|
||||
import {HomeServerError, ConnectionError, AbortError} from "./error.js";
|
||||
import {Sync, SyncStatus} from "./Sync.js";
|
||||
import {Session} from "./Session.js";
|
||||
|
||||
|
@ -124,7 +123,7 @@ export class SessionContainer {
|
|||
await this._platform.sessionInfoStorage.add(sessionInfo);
|
||||
} catch (err) {
|
||||
this._error = err;
|
||||
if (err instanceof HomeServerError) {
|
||||
if (err.name === "HomeServerError") {
|
||||
if (err.errcode === "M_FORBIDDEN") {
|
||||
this._loginFailure = LoginFailure.Credentials;
|
||||
} else {
|
||||
|
@ -132,7 +131,7 @@ export class SessionContainer {
|
|||
}
|
||||
log.set("loginFailure", this._loginFailure);
|
||||
this._status.set(LoadStatus.LoginFailed);
|
||||
} else if (err instanceof ConnectionError) {
|
||||
} else if (err.name === "ConnectionError") {
|
||||
this._loginFailure = LoginFailure.Connection;
|
||||
this._status.set(LoadStatus.LoginFailed);
|
||||
} else {
|
||||
|
@ -253,7 +252,7 @@ export class SessionContainer {
|
|||
}
|
||||
} catch (err) {
|
||||
// if dispose is called from stop, bail out
|
||||
if (err instanceof AbortError) {
|
||||
if (err.name === "AbortError") {
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
|
|
Loading…
Reference in a new issue