mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
client: tidy up error message handling
This commit is contained in:
parent
7ddcfd5ae5
commit
3867cece40
@ -13,10 +13,10 @@ export function bandwidth(domNode, conn) {
|
||||
|
||||
/**
|
||||
* Generate an SVG visualisation of the sliding lists and attaches it as a child to the domNode provided.
|
||||
* Does nothing if there are no resp.ops.
|
||||
* @param {Element} domNode The node to insert the SVG into.
|
||||
* @param {[]SlidingList} activeLists The lists
|
||||
* @param {object} resp The Sliding Sync response JSON
|
||||
* @returns {SVGSVGElement}
|
||||
*/
|
||||
export function svgify(domNode, activeLists, resp) {
|
||||
if (resp.ops.length === 0) {
|
||||
|
@ -3,7 +3,6 @@ import { SlidingList, SlidingSyncConnection } from './sync.js';
|
||||
import * as render from './render.js';
|
||||
import * as devtools from './devtools.js';
|
||||
|
||||
let lastError = null;
|
||||
let activeSessionId;
|
||||
let activeRoomId = ""; // the room currently being viewed
|
||||
let syncConnection = new SlidingSyncConnection();
|
||||
@ -366,7 +365,6 @@ const doSyncLoop = async (accessToken, sessionId) => {
|
||||
console.log("Starting sync loop. Active: ", activeSessionId, " this:", sessionId);
|
||||
|
||||
let currentPos;
|
||||
let currentError = null;
|
||||
let currentSub = "";
|
||||
while (sessionId === activeSessionId) {
|
||||
let resp;
|
||||
@ -416,14 +414,12 @@ const doSyncLoop = async (accessToken, sessionId) => {
|
||||
activeLists[index].joinedCount = count;
|
||||
});
|
||||
}
|
||||
// reset any error message
|
||||
document.getElementById("errorMsg").textContent = "";
|
||||
} catch (err) {
|
||||
if (err.name !== "AbortError") {
|
||||
console.error("/sync failed:", err);
|
||||
console.log("current", currentError, "last", lastError);
|
||||
if (currentError != lastError) {
|
||||
document.getElementById("errorMsg").textContent = lastError ? lastError : "";
|
||||
}
|
||||
currentError = lastError;
|
||||
document.getElementById("errorMsg").textContent = err;
|
||||
await sleep(3000);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user