Skip to content

Commit 7e52690

Browse files
committed
chore: remove try catch block from checkRoomAcl
1 parent 5cf78a4 commit 7e52690

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

packages/federation-sdk/src/services/federation-validation.service.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,21 @@ export class FederationValidationService {
4343
}
4444

4545
private async checkRoomAcl(roomId: RoomID, domain: string): Promise<void> {
46-
try {
47-
const state = await this.stateService.getLatestRoomState(roomId);
48-
const aclEvent = state.get('m.room.server_acl:');
49-
if (!aclEvent || !aclEvent.isServerAclEvent()) {
50-
return;
51-
}
52-
53-
const isAllowed = await this.eventAuthorizationService.checkServerAcl(
54-
aclEvent,
55-
domain,
46+
const state = await this.stateService.getLatestRoomState(roomId);
47+
const aclEvent = state.get('m.room.server_acl:');
48+
if (!aclEvent || !aclEvent.isServerAclEvent()) {
49+
return;
50+
}
51+
52+
const isAllowed = await this.eventAuthorizationService.checkServerAcl(
53+
aclEvent,
54+
domain,
55+
);
56+
if (!isAllowed) {
57+
throw new FederationValidationError(
58+
'POLICY_DENIED',
59+
"Action Blocked. The room's access control policy blocks communication with this domain.",
5660
);
57-
if (!isAllowed) {
58-
throw new FederationValidationError(
59-
'POLICY_DENIED',
60-
"Action Blocked. The room's access control policy blocks communication with this domain.",
61-
);
62-
}
63-
} catch (error) {
64-
if (error instanceof FederationValidationError) {
65-
throw error;
66-
}
6761
}
6862
}
6963

0 commit comments

Comments
 (0)