Fix use of logger that assumes it interpolates strings (#10789)

This commit is contained in:
Andy Balaam 2023-05-05 11:56:15 +01:00 committed by GitHub
parent 02de2f5ba9
commit 7856d84034
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -1504,7 +1504,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
if (state === SyncState.Syncing && prevState === SyncState.Syncing) { if (state === SyncState.Syncing && prevState === SyncState.Syncing) {
return; return;
} }
logger.info("MatrixClient sync state => %s", state); logger.info(`MatrixClient sync state => ${state}`);
if (state !== SyncState.Prepared) { if (state !== SyncState.Prepared) {
return; return;
} }
@ -1863,7 +1863,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
subAction: params?.action, subAction: params?.action,
}); });
} else { } else {
logger.info("Ignoring showScreen for '%s'", screen); logger.info(`Ignoring showScreen for '${screen}'`);
} }
} }

View file

@ -842,7 +842,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// making it impossible to indicate a newly joined room. // making it impossible to indicate a newly joined room.
if (!joining && roomId) { if (!joining && roomId) {
if (!room && shouldPeek) { if (!room && shouldPeek) {
logger.info("Attempting to peek into room %s", roomId); logger.info(`Attempting to peek into room ${roomId}`);
this.setState({ this.setState({
peekLoading: true, peekLoading: true,
isPeeking: true, // this will change to false if peeking fails isPeeking: true, // this will change to false if peeking fails
@ -1671,7 +1671,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}); });
}, },
(error) => { (error) => {
logger.error("Failed to reject invite: %s", error); logger.error(`Failed to reject invite: ${error}`);
const msg = error.message ? error.message : JSON.stringify(error); const msg = error.message ? error.message : JSON.stringify(error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
@ -1705,7 +1705,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
rejecting: false, rejecting: false,
}); });
} catch (error) { } catch (error) {
logger.error("Failed to reject invite: %s", error); logger.error(`Failed to reject invite: ${error}`);
const msg = error.message ? error.message : JSON.stringify(error); const msg = error.message ? error.message : JSON.stringify(error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {

View file

@ -94,7 +94,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
throw new Error("This server has not supplied enough information for Recaptcha authentication"); throw new Error("This server has not supplied enough information for Recaptcha authentication");
} }
logger.info("Rendering to %s", divId); logger.info(`Rendering to ${divId}`);
this.captchaWidgetId = global.grecaptcha?.render(divId, { this.captchaWidgetId = global.grecaptcha?.render(divId, {
sitekey: publicKey, sitekey: publicKey,
callback: this.props.onCaptchaResponse, callback: this.props.onCaptchaResponse,

View file

@ -78,7 +78,7 @@ export async function runSlashCommand(
} }
} }
if (error) { if (error) {
logger.error("Command failure: %s", error); logger.error(`Command failure: ${error}`);
// assume the error is a server error when the command is async // assume the error is a server error when the command is async
const isServerError = !!result.promise; const isServerError = !!result.promise;
const title = isServerError ? _td("Server error") : _td("Command error"); const title = isServerError ? _td("Server error") : _td("Command error");