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.
|
* 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 {Element} domNode The node to insert the SVG into.
|
||||||
* @param {[]SlidingList} activeLists The lists
|
* @param {[]SlidingList} activeLists The lists
|
||||||
* @param {object} resp The Sliding Sync response JSON
|
* @param {object} resp The Sliding Sync response JSON
|
||||||
* @returns {SVGSVGElement}
|
|
||||||
*/
|
*/
|
||||||
export function svgify(domNode, activeLists, resp) {
|
export function svgify(domNode, activeLists, resp) {
|
||||||
if (resp.ops.length === 0) {
|
if (resp.ops.length === 0) {
|
||||||
|
@ -3,7 +3,6 @@ import { SlidingList, SlidingSyncConnection } from './sync.js';
|
|||||||
import * as render from './render.js';
|
import * as render from './render.js';
|
||||||
import * as devtools from './devtools.js';
|
import * as devtools from './devtools.js';
|
||||||
|
|
||||||
let lastError = null;
|
|
||||||
let activeSessionId;
|
let activeSessionId;
|
||||||
let activeRoomId = ""; // the room currently being viewed
|
let activeRoomId = ""; // the room currently being viewed
|
||||||
let syncConnection = new SlidingSyncConnection();
|
let syncConnection = new SlidingSyncConnection();
|
||||||
@ -366,7 +365,6 @@ const doSyncLoop = async (accessToken, sessionId) => {
|
|||||||
console.log("Starting sync loop. Active: ", activeSessionId, " this:", sessionId);
|
console.log("Starting sync loop. Active: ", activeSessionId, " this:", sessionId);
|
||||||
|
|
||||||
let currentPos;
|
let currentPos;
|
||||||
let currentError = null;
|
|
||||||
let currentSub = "";
|
let currentSub = "";
|
||||||
while (sessionId === activeSessionId) {
|
while (sessionId === activeSessionId) {
|
||||||
let resp;
|
let resp;
|
||||||
@ -416,14 +414,12 @@ const doSyncLoop = async (accessToken, sessionId) => {
|
|||||||
activeLists[index].joinedCount = count;
|
activeLists[index].joinedCount = count;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// reset any error message
|
||||||
|
document.getElementById("errorMsg").textContent = "";
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.name !== "AbortError") {
|
if (err.name !== "AbortError") {
|
||||||
console.error("/sync failed:", err);
|
console.error("/sync failed:", err);
|
||||||
console.log("current", currentError, "last", lastError);
|
document.getElementById("errorMsg").textContent = err;
|
||||||
if (currentError != lastError) {
|
|
||||||
document.getElementById("errorMsg").textContent = lastError ? lastError : "";
|
|
||||||
}
|
|
||||||
currentError = lastError;
|
|
||||||
await sleep(3000);
|
await sleep(3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user