Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 89bb9d4

Browse files
committed
Better room not found errors
1 parent 6af8008 commit 89bb9d4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/SlashCommands.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ export const Commands = [
446446
return success(cli.setRoomTopic(roomId, args));
447447
}
448448
const room = cli.getRoom(roomId);
449-
if (!room) return reject(newTranslatableError("Failed to set topic"));
449+
if (!room) {
450+
return reject(
451+
newTranslatableError("Failed to set topic: Unable to find room (%(roomId)s", { roomId }),
452+
);
453+
}
450454

451455
const topicEvents = room.currentState.getStateEvents('m.room.topic', '');
452456
const topic = topicEvents && topicEvents.getContent().topic;
@@ -841,7 +845,11 @@ export const Commands = [
841845
if (!isNaN(powerLevel)) {
842846
const cli = MatrixClientPeg.get();
843847
const room = cli.getRoom(roomId);
844-
if (!room) return reject(newTranslatableError("Command failed"));
848+
if (!room) {
849+
return reject(
850+
newTranslatableError("Command failed: Unable to find room (%(roomId)s", { roomId }),
851+
);
852+
}
845853
const member = room.getMember(userId);
846854
if (!member || getEffectiveMembership(member.membership) === EffectiveMembership.Leave) {
847855
return reject(newTranslatableError("Could not find user in room"));

0 commit comments

Comments
 (0)