Conform more of the codebase to strictNullChecks (#11100)

This commit is contained in:
Michael Telatynski 2023-06-22 14:39:36 +01:00 committed by GitHub
parent 328db8fdfd
commit 7b3a4e556a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 30 additions and 26 deletions

View file

@ -160,7 +160,7 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
if (!this.unmounted) {
this.setState({
downloadBusy: false,
downloadProgress: _t("Failed to send logs: ") + `${err.message}`,
downloadProgress: _t("Failed to send logs: ") + `${err instanceof Error ? err.message : ""}`,
});
}
}

View file

@ -16,6 +16,7 @@ limitations under the License.
import React from "react";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { HTTPError, MatrixError } from "matrix-js-sdk/src/matrix";
import { _t } from "../../../languageHandler";
import ConfirmRedactDialog from "./ConfirmRedactDialog";
@ -62,7 +63,13 @@ export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IPro
await this.props.redact();
this.props.onFinished(true);
} catch (error) {
const code = error.errcode || error.statusCode;
let code: string | number | undefined;
if (error instanceof MatrixError) {
code = error.errcode;
} else if (error instanceof HTTPError) {
code = error.httpStatus;
}
if (typeof code !== "undefined") {
this.setState({ redactionErrorCode: code });
} else {