mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
better error handling if something goes wrong serializing log items
This commit is contained in:
parent
338f628627
commit
2dd8803efc
@ -35,9 +35,13 @@ export class BaseLogger {
|
|||||||
// if not filter is specified, filter out anything lower than the initial log level
|
// if not filter is specified, filter out anything lower than the initial log level
|
||||||
filter = filter.minLevel(logLevel);
|
filter = filter.minLevel(logLevel);
|
||||||
}
|
}
|
||||||
const serialized = item.serialize(filter, 0);
|
try {
|
||||||
if (serialized) {
|
const serialized = item.serialize(filter, 0);
|
||||||
this._persistItem(serialized);
|
if (serialized) {
|
||||||
|
this._persistItem(serialized);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn("Could not serialize log item", err);
|
||||||
}
|
}
|
||||||
this._openItems.delete(item);
|
this._openItems.delete(item);
|
||||||
};
|
};
|
||||||
@ -65,9 +69,13 @@ export class BaseLogger {
|
|||||||
_finishOpenItems() {
|
_finishOpenItems() {
|
||||||
for (const openItem of this._openItems) {
|
for (const openItem of this._openItems) {
|
||||||
openItem.finish();
|
openItem.finish();
|
||||||
const serialized = openItem.serialize(this._baseLogLevel);
|
try {
|
||||||
if (serialized) {
|
const serialized = openItem.serialize(this._baseLogLevel);
|
||||||
this._persistItem(serialized);
|
if (serialized) {
|
||||||
|
this._persistItem(serialized);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn("Could not serialize log item", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._openItems.clear();
|
this._openItems.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user