Replace console.error with logger.error
Related https://github.com/vector-im/element-web/issues/18425
This commit is contained in:
parent
9c594a8a96
commit
5e73a212f4
124 changed files with 417 additions and 250 deletions
|
@ -41,6 +41,8 @@ import TruncatedList from "../elements/TruncatedList";
|
|||
import EntityTile from "../rooms/EntityTile";
|
||||
import BaseAvatar from "../avatars/BaseAvatar";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps {
|
||||
space: Room;
|
||||
onCreateRoomClick(): void;
|
||||
|
@ -160,7 +162,7 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
|||
});
|
||||
setProgress(i => i + 1);
|
||||
} catch (e) {
|
||||
console.error("Failed to add rooms to space", e);
|
||||
logger.error("Failed to add rooms to space", e);
|
||||
setError(error = e);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ import AddressTile from '../elements/AddressTile';
|
|||
import BaseDialog from "./BaseDialog";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
const TRUNCATE_QUERY_LIST = 40;
|
||||
const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200;
|
||||
|
||||
|
@ -225,7 +227,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
this.doRoomSearch(query);
|
||||
}
|
||||
} else {
|
||||
console.error('Unknown pickerType', this.props.pickerType);
|
||||
logger.error('Unknown pickerType', this.props.pickerType);
|
||||
}
|
||||
}, QUERY_USER_DIRECTORY_DEBOUNCE_MS);
|
||||
} else {
|
||||
|
@ -282,7 +284,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
});
|
||||
this.processResults(results, query);
|
||||
}).catch((err) => {
|
||||
console.error('Error whilst searching group rooms: ', err);
|
||||
logger.error('Error whilst searching group rooms: ', err);
|
||||
this.setState({
|
||||
searchError: err.errcode ? err.message : _t('Something went wrong!'),
|
||||
});
|
||||
|
@ -388,7 +390,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
}
|
||||
this.processResults(resp.results, query);
|
||||
}).catch((err) => {
|
||||
console.error('Error whilst searching user directory: ', err);
|
||||
logger.error('Error whilst searching user directory: ', err);
|
||||
this.setState({
|
||||
searchError: err.errcode ? err.message : _t('Something went wrong!'),
|
||||
});
|
||||
|
@ -582,7 +584,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
}],
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.setState({
|
||||
searchError: _t('Something went wrong!'),
|
||||
});
|
||||
|
|
|
@ -33,6 +33,8 @@ import ErrorDialog from "./ErrorDialog";
|
|||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import { mediaFromMxc } from "../../../customisations/Media";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
roomId: string;
|
||||
communityName: string;
|
||||
|
@ -99,7 +101,7 @@ export default class CommunityPrototypeInviteDialog extends React.PureComponent<
|
|||
}
|
||||
} catch (e) {
|
||||
this.setState({ busy: false });
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
Modal.createTrackedDialog('Failed to invite', '', ErrorDialog, {
|
||||
title: _t("Failed to invite"),
|
||||
description: ((e && e.message) ? e.message : _t("Operation failed")),
|
||||
|
|
|
@ -27,6 +27,8 @@ import { showCommunityRoomInviteDialog } from "../../../RoomInvite";
|
|||
import GroupStore from "../../../stores/GroupStore";
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
}
|
||||
|
||||
|
@ -110,7 +112,7 @@ export default class CreateCommunityPrototypeDialog extends React.PureComponent<
|
|||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.setState({
|
||||
busy: false,
|
||||
error: _t(
|
||||
|
|
|
@ -42,6 +42,8 @@ import TagOrderActions from "../../../actions/TagOrderActions";
|
|||
import { inviteUsersToRoom } from "../../../RoomInvite";
|
||||
import ProgressBar from "../elements/ProgressBar";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps {
|
||||
matrixClient: MatrixClient;
|
||||
groupId: string;
|
||||
|
@ -271,7 +273,7 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
|
|||
},
|
||||
}, "mx_CreateSpaceFromCommunityDialog_SuccessInfoDialog");
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
setError(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ import { createSpace, SpaceCreateForm } from "../spaces/SpaceCreateMenu";
|
|||
import { SubspaceSelector } from "./AddExistingToSpaceDialog";
|
||||
import JoinRuleDropdown from "../elements/JoinRuleDropdown";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps {
|
||||
space: Room;
|
||||
onAddExistingSpaceClick(): void;
|
||||
|
@ -83,7 +85,7 @@ const CreateSubspaceDialog: React.FC<IProps> = ({ space, onAddExistingSpaceClick
|
|||
|
||||
onFinished(true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ import StyledCheckbox from "../elements/StyledCheckbox";
|
|||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps {
|
||||
onFinished: (success: boolean) => void;
|
||||
}
|
||||
|
@ -112,7 +114,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
|||
return;
|
||||
}
|
||||
|
||||
console.error("Error during UI Auth:", { result });
|
||||
logger.error("Error during UI Auth:", { result });
|
||||
this.setState({ errStr: _t("There was a problem communicating with the server. Please try again.") });
|
||||
};
|
||||
|
||||
|
@ -126,7 +128,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
|||
Lifecycle.onLoggedOut();
|
||||
this.props.onFinished(true);
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.setState({ errStr: _t("There was a problem communicating with the server. Please try again.") });
|
||||
});
|
||||
};
|
||||
|
|
|
@ -26,6 +26,8 @@ import FlairStore from "../../../stores/FlairStore";
|
|||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import { mediaFromMxc } from "../../../customisations/Media";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
communityId: string;
|
||||
}
|
||||
|
@ -89,7 +91,7 @@ export default class EditCommunityPrototypeDialog extends React.PureComponent<IP
|
|||
// we did it, so close the dialog
|
||||
this.props.onFinished(true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.setState({
|
||||
busy: false,
|
||||
error: _t("There was an error updating your community. The server is unable to process your request."),
|
||||
|
|
|
@ -38,6 +38,8 @@ import Exporter from "../../../utils/exportUtils/Exporter";
|
|||
import Spinner from "../elements/Spinner";
|
||||
import InfoDialog from "./InfoDialog";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
room: Room;
|
||||
}
|
||||
|
@ -102,7 +104,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
|||
);
|
||||
break;
|
||||
default:
|
||||
console.error("Unknown export format");
|
||||
logger.error("Unknown export format");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -731,7 +731,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
await createRoom(createRoomOptions);
|
||||
this.props.onFinished();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
logger.error(err);
|
||||
this.setState({
|
||||
busy: false,
|
||||
errorText: _t("We couldn't create your DM."),
|
||||
|
@ -749,7 +749,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
const cli = MatrixClientPeg.get();
|
||||
const room = cli.getRoom(this.props.roomId);
|
||||
if (!room) {
|
||||
console.error("Failed to find the room to invite users to");
|
||||
logger.error("Failed to find the room to invite users to");
|
||||
this.setState({
|
||||
busy: false,
|
||||
errorText: _t("Something went wrong trying to invite the users."),
|
||||
|
@ -784,7 +784,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
logger.error(err);
|
||||
this.setState({
|
||||
busy: false,
|
||||
errorText: _t(
|
||||
|
@ -893,8 +893,8 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
})),
|
||||
});
|
||||
}).catch(e => {
|
||||
console.error("Error searching user directory:");
|
||||
console.error(e);
|
||||
logger.error("Error searching user directory:");
|
||||
logger.error(e);
|
||||
this.setState({ serverResultsMixin: [] }); // clear results because it's moderately fatal
|
||||
});
|
||||
|
||||
|
@ -948,8 +948,8 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
}],
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Error searching identity server:");
|
||||
console.error(e);
|
||||
logger.error("Error searching identity server:");
|
||||
logger.error(e);
|
||||
this.setState({ threepidResultsMixin: [] }); // clear results because it's moderately fatal
|
||||
}
|
||||
}
|
||||
|
@ -1062,8 +1062,8 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
avatar_url: avatarUrl,
|
||||
}));
|
||||
} catch (e) {
|
||||
console.error("Error looking up profile for " + address);
|
||||
console.error(e);
|
||||
logger.error("Error looking up profile for " + address);
|
||||
logger.error(e);
|
||||
failed.push(address);
|
||||
}
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
</AccessibleButton>
|
||||
</div>;
|
||||
} else {
|
||||
console.error("Unknown kind of InviteDialog: " + this.props.kind);
|
||||
logger.error("Unknown kind of InviteDialog: " + this.props.kind);
|
||||
}
|
||||
|
||||
const goButton = this.props.kind == KIND_CALL_TRANSFER ? null : <AccessibleButton
|
||||
|
|
|
@ -30,6 +30,8 @@ import { IDialogProps } from "./IDialogProps";
|
|||
import { EventType, RelationType } from "matrix-js-sdk/src/@types/event";
|
||||
import { defer } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
mxEvent: MatrixEvent;
|
||||
}
|
||||
|
@ -78,7 +80,7 @@ export default class MessageEditHistoryDialog extends React.PureComponent<IProps
|
|||
} catch (error) {
|
||||
// log if the server returned an error
|
||||
if (error.errcode) {
|
||||
console.error("fetching /relations failed with error", error);
|
||||
logger.error("fetching /relations failed with error", error);
|
||||
}
|
||||
this.setState({ error }, () => reject(error));
|
||||
return promise;
|
||||
|
|
|
@ -28,6 +28,8 @@ import TextWithTooltip from "../elements/TextWithTooltip";
|
|||
import withValidation, { IFieldState } from "../elements/Validation";
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps {
|
||||
title?: string;
|
||||
serverConfig: ValidatedServerConfig;
|
||||
|
@ -93,7 +95,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
this.validatedConf = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(hsUrl, discoveryResult);
|
||||
return {}; // we have a validated config, we don't need to try the other paths
|
||||
} catch (e) {
|
||||
console.error(`Attempted ${hsUrl} as a server_name but it failed`, e);
|
||||
logger.error(`Attempted ${hsUrl} as a server_name but it failed`, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +109,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
this.validatedConf = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl);
|
||||
return {};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
|
||||
const stateForError = AutoDiscoveryUtils.authComponentStateForError(e);
|
||||
if (stateForError.serverErrorIsFatal) {
|
||||
|
@ -123,7 +125,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
this.validatedConf = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl, null, true);
|
||||
return {};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
return { error: _t("Invalid URL") };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import BaseDialog from "./BaseDialog";
|
|||
import EditableText from "../elements/EditableText";
|
||||
import { IDialogProps } from "./IDialogProps";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
title: string;
|
||||
}
|
||||
|
@ -83,7 +85,7 @@ export default class SetEmailDialog extends React.Component<IProps, IState> {
|
|||
});
|
||||
}, (err) => {
|
||||
this.setState({ emailBusy: false });
|
||||
console.error("Unable to add email address " + emailAddress + " " + err);
|
||||
logger.error("Unable to add email address " + emailAddress + " " + err);
|
||||
Modal.createTrackedDialog('Unable to add email address', '', ErrorDialog, {
|
||||
title: _t("Unable to add email address"),
|
||||
description: ((err && err.message) ? err.message : _t("Operation failed")),
|
||||
|
@ -119,7 +121,7 @@ export default class SetEmailDialog extends React.Component<IProps, IState> {
|
|||
onFinished: this.onEmailDialogFinished,
|
||||
});
|
||||
} else {
|
||||
console.error("Unable to verify email address: " + err);
|
||||
logger.error("Unable to verify email address: " + err);
|
||||
Modal.createTrackedDialog('Unable to verify email address', '', ErrorDialog, {
|
||||
title: _t("Unable to verify email address."),
|
||||
description: ((err && err.message) ? err.message : _t("Operation failed")),
|
||||
|
|
|
@ -27,6 +27,8 @@ import AccessibleButton from "../elements/AccessibleButton";
|
|||
import IntegrationManager from "../settings/IntegrationManager";
|
||||
import { IDialogProps } from "./IDialogProps";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
/**
|
||||
* Optional room where the integration manager should be open to
|
||||
|
@ -116,7 +118,7 @@ export default class TabbedIntegrationManagerDialog extends React.Component<IPro
|
|||
return;
|
||||
}
|
||||
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.setState({
|
||||
busy: false,
|
||||
currentLoading: false,
|
||||
|
|
|
@ -28,6 +28,8 @@ import { IDialogProps } from "../IDialogProps";
|
|||
import { accessSecretStorage } from "../../../../SecurityManager";
|
||||
import Modal from "../../../../Modal";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
// Maximum acceptable size of a key file. It's 59 characters including the spaces we encode,
|
||||
// so this should be plenty and allow for people putting extra whitespace in the file because
|
||||
// maybe that's a thing people would do?
|
||||
|
@ -252,7 +254,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
this.props.onFinished(true);
|
||||
}, true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
logger.error(e);
|
||||
this.props.onFinished(false);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -165,7 +165,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
|
|||
}
|
||||
|
||||
this.setState({ error: e });
|
||||
console.error("Error bootstrapping cross-signing", e);
|
||||
logger.error("Error bootstrapping cross-signing", e);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue