mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-14 18:51:33 +03:00
Add try catch for event tile errors
This commit is contained in:
parent
6dd3631a17
commit
c81bac1a4c
2 changed files with 34 additions and 26 deletions
|
@ -46,7 +46,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
callState: this.props.callEventGrouper.state,
|
callState: this.props.callEventGrouper?.state,
|
||||||
silenced: false,
|
silenced: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ export default class CallEvent extends React.Component<IProps, IState> {
|
||||||
render() {
|
render() {
|
||||||
const event = this.props.mxEvent;
|
const event = this.props.mxEvent;
|
||||||
const sender = event.sender ? event.sender.name : event.getSender();
|
const sender = event.sender ? event.sender.name : event.getSender();
|
||||||
const isVoice = this.props.callEventGrouper.isVoice;
|
const isVoice = this.props.callEventGrouper?.isVoice;
|
||||||
const callType = isVoice ? _t("Voice call") : _t("Video call");
|
const callType = isVoice ? _t("Voice call") : _t("Video call");
|
||||||
const content = this.renderContent(this.state.callState);
|
const content = this.renderContent(this.state.callState);
|
||||||
const className = classNames({
|
const className = classNames({
|
||||||
|
|
|
@ -301,13 +301,16 @@ export default class HTMLExporter extends Exporter {
|
||||||
|
|
||||||
protected async createMessageBody(mxEv: MatrixEvent, joined = false) {
|
protected async createMessageBody(mxEv: MatrixEvent, joined = false) {
|
||||||
let eventTile: string;
|
let eventTile: string;
|
||||||
|
try {
|
||||||
if (this.isAttachment(mxEv)) {
|
if (this.isAttachment(mxEv)) {
|
||||||
if (this.exportOptions.attachmentsIncluded) {
|
if (this.exportOptions.attachmentsIncluded) {
|
||||||
try {
|
try {
|
||||||
const blob = await this.getMediaBlob(mxEv);
|
const blob = await this.getMediaBlob(mxEv);
|
||||||
if (this.totalSize + blob.size > this.exportOptions.maxSize) {
|
if (this.totalSize + blob.size > this.exportOptions.maxSize) {
|
||||||
eventTile = await this.getEventTile(this.createModifiedEvent(this.mediaOmitText, mxEv), joined);
|
eventTile = await this.getEventTile(
|
||||||
|
this.createModifiedEvent(this.mediaOmitText, mxEv),
|
||||||
|
joined,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.totalSize += blob.size;
|
this.totalSize += blob.size;
|
||||||
const filePath = this.getFilePath(mxEv);
|
const filePath = this.getFilePath(mxEv);
|
||||||
|
@ -328,6 +331,11 @@ export default class HTMLExporter extends Exporter {
|
||||||
eventTile = await this.getEventTile(this.createModifiedEvent(this.mediaOmitText, mxEv), joined);
|
eventTile = await this.getEventTile(this.createModifiedEvent(this.mediaOmitText, mxEv), joined);
|
||||||
}
|
}
|
||||||
} else eventTile = await this.getEventTile(mxEv, joined);
|
} else eventTile = await this.getEventTile(mxEv, joined);
|
||||||
|
} catch (e) {
|
||||||
|
// TODO: Handle callEvent errors
|
||||||
|
console.error(e);
|
||||||
|
eventTile = await this.getEventTile(this.createModifiedEvent("Error parsing HTML", mxEv), joined);
|
||||||
|
}
|
||||||
|
|
||||||
return eventTile;
|
return eventTile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue