cetirizine

An experimental matrix client written in reactjs utilizing tailwind and storybook
git clone git://archive.git.mtrnord.blog/MTRNord/cetirizine.git
Log | Files | Refs | README | LICENSE

commit f6b0802157715a8cbe6b0bc6045dabc039ea25c6
parent 49becbdb392509dff8ac10c9591f67e9d32f7c2f
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 19 Sep 2023 11:31:02 +0200

Fix missing error handling

Diffstat:
Msrc/app/sdk/e2ee.ts | 12++++++------
Msrc/components/input/chat/plugins/mentions/MentionsPlugin.tsx | 8+++++++-
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/app/sdk/e2ee.ts b/src/app/sdk/e2ee.ts @@ -17,7 +17,7 @@ import { MatrixClient } from "./client"; import { OwnUser } from "./ownUser"; import { Room } from "./room"; import { IRoomEvent } from "./api/events"; -import { HostnameMissingError, NotLogeedInError, OlmMachineNotSetup, SDKError } from "./utils"; +import { HostnameMissingError, NotLogeedInError, OlmMachineNotSetupError, SDKError } from "./utils"; export class MatrixE2EE { private olmMachine?: OlmMachine; @@ -49,7 +49,7 @@ export class MatrixE2EE { return new NotLogeedInError(); } if (!this.olmMachine) { - return new OlmMachineNotSetup(); + return new OlmMachineNotSetupError(); } return await this.olmMachine?.encryptRoomEvent(roomID, type, content); } @@ -71,7 +71,7 @@ export class MatrixE2EE { return new HostnameMissingError(); } if (!this.olmMachine) { - return new OlmMachineNotSetup(); + return new OlmMachineNotSetupError(); } if (this.outgoingRequestsBeingProcessed) { @@ -97,7 +97,7 @@ export class MatrixE2EE { return new HostnameMissingError(); } if (!this.olmMachine) { - return new OlmMachineNotSetup(); + return new OlmMachineNotSetupError(); } const encryptionSettings = room.getEncryptionSettings(); if (encryptionSettings) { @@ -116,7 +116,7 @@ export class MatrixE2EE { return new HostnameMissingError(); } if (!this.olmMachine) { - return new OlmMachineNotSetup(); + return new OlmMachineNotSetupError(); } if (this.missingSessionsBeingRequested) { @@ -142,7 +142,7 @@ export class MatrixE2EE { return new HostnameMissingError(); } if (!this.olmMachine) { - return new OlmMachineNotSetup(); + return new OlmMachineNotSetupError(); } // Check which type the request is if (request.type === RequestType.KeysUpload) { diff --git a/src/components/input/chat/plugins/mentions/MentionsPlugin.tsx b/src/components/input/chat/plugins/mentions/MentionsPlugin.tsx @@ -12,6 +12,7 @@ import * as ReactDOM from "react-dom"; import { $createMentionNode } from "./MentionNode"; import { Room } from "../../../../../app/sdk/room"; import { IRoomMemberEvent } from "../../../../../app/sdk/api/events"; +import { SDKError } from "../../../../../app/sdk/utils"; const PUNCTUATION = "\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;"; @@ -85,7 +86,12 @@ const mentionsCache = new Map(); const dummyLookupService = { search(string: string, room: Room, callback: (results: IRoomMemberEvent[]) => void): void { setTimeout(async () => { - const results = (await room.joinedMembers()).filter((member) => { + const members = await room.joinedMembers(); + if (members instanceof SDKError) { + console.error(members); + return + } + const results = members.filter((member) => { if (member.content.displayname) { return member.content.displayname.toLowerCase().includes(string.toLowerCase()) || member.state_key.toLowerCase().includes(string.toLowerCase()); } else {