Conform more of the codebase to strictNullChecks
(#11100)
This commit is contained in:
parent
328db8fdfd
commit
7b3a4e556a
16 changed files with 30 additions and 26 deletions
|
@ -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 : ""}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue