This commit is contained in:
James Salter 2021-08-16 13:06:19 +01:00
parent 065a70b63f
commit 16d02f24bd
4 changed files with 9 additions and 7 deletions

View file

@ -108,7 +108,7 @@ import SoftLogout from './auth/SoftLogout';
import { makeRoomPermalink } from "../../utils/permalinks/Permalinks"; import { makeRoomPermalink } from "../../utils/permalinks/Permalinks";
import { copyPlaintext } from "../../utils/strings"; import { copyPlaintext } from "../../utils/strings";
import { PosthogAnalytics } from '../../PosthogAnalytics'; import { PosthogAnalytics } from '../../PosthogAnalytics';
import { initSentry, sendSentryReport } from "../../sentry"; import { initSentry } from "../../sentry";
/** constants for MatrixChat.state.view */ /** constants for MatrixChat.state.view */
export enum Views { export enum Views {

View file

@ -71,7 +71,7 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
private onBugReport = (): void => { private onBugReport = (): void => {
Modal.createTrackedDialog('Bug Report Dialog', '', BugReportDialog, { Modal.createTrackedDialog('Bug Report Dialog', '', BugReportDialog, {
label: 'react-soft-crash', label: 'react-soft-crash',
error: this.state.error error: this.state.error,
}); });
}; };

View file

@ -451,6 +451,8 @@ export default class EventTile extends React.Component<IProps, IState> {
client.on("Room.receipt", this.onRoomReceipt); client.on("Room.receipt", this.onRoomReceipt);
this.isListeningForReceipts = true; this.isListeningForReceipts = true;
} }
throw new Error("oops");
} }
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event // TODO: [REACT-WARNING] Replace with appropriate lifecycle event

View file

@ -21,7 +21,7 @@ import { MatrixClientPeg } from "./MatrixClientPeg";
import SettingsStore from "./settings/SettingsStore"; import SettingsStore from "./settings/SettingsStore";
import { MatrixClient } from "../../matrix-js-sdk"; import { MatrixClient } from "../../matrix-js-sdk";
async function getStorageOptions(): Record<string, string> { async function getStorageOptions(): Promise<Record<string, string>> {
const result = {}; const result = {};
// add storage persistence/quota information // add storage persistence/quota information
@ -65,7 +65,7 @@ function getEnabledLabs(): string {
} }
} }
async function getCryptoContext(client: MatrixClient): Record<String, String> { async function getCryptoContext(client: MatrixClient): Promise<Record<string, string>> {
if (!client.isCryptoEnabled()) { if (!client.isCryptoEnabled()) {
return {}; return {};
} }
@ -98,7 +98,7 @@ async function getCryptoContext(client: MatrixClient): Record<String, String> {
}; };
} }
function getDeviceContext(client: MatrixClient): Record<String, String> { function getDeviceContext(client: MatrixClient): Record<string, string> {
const result = { const result = {
"device_id": client?.deviceId, "device_id": client?.deviceId,
"mx_local_settings": localStorage.getItem('mx_local_settings'), "mx_local_settings": localStorage.getItem('mx_local_settings'),
@ -114,7 +114,7 @@ function getDeviceContext(client: MatrixClient): Record<String, String> {
return result; return result;
} }
async function getContexts() { async function getContexts(): Promise<Record<string, any>> {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
return { return {
"user": getUserContext(client), "user": getUserContext(client),
@ -124,7 +124,7 @@ async function getContexts() {
}; };
} }
export async function sendSentryReport(userText: string, issueUrl: string, error: Error): void { export async function sendSentryReport(userText: string, issueUrl: string, error: Error): Promise<void> {
const sentryConfig = SdkConfig.get()["sentry"]; const sentryConfig = SdkConfig.get()["sentry"];
if (!sentryConfig) return; if (!sentryConfig) return;