mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Merge pull request #476 from TeamPiped/better-room-join-logging
Add better error messages on room join fail
This commit is contained in:
commit
5abb3107d5
1 changed files with 14 additions and 6 deletions
|
@ -42,12 +42,20 @@ public class MatrixHelper {
|
|||
}
|
||||
|
||||
if (UNAUTHENTICATED) {
|
||||
ROOM_ID = RequestUtils.getJsonNode(h2client, new Request.Builder()
|
||||
.url(MATRIX_SERVER + "/_matrix/client/v3/directory/room/" + URLUtils.silentEncode(MATRIX_ROOM))
|
||||
.header("Authorization", "Bearer " + MATRIX_TOKEN)
|
||||
.build())
|
||||
.get("room_id")
|
||||
.asText();
|
||||
|
||||
var joinResp = RequestUtils.getJsonNode(h2client, new Request.Builder()
|
||||
.url(MATRIX_SERVER + "/_matrix/client/v3/directory/room/" + URLUtils.silentEncode(MATRIX_ROOM))
|
||||
.header("Authorization", "Bearer " + MATRIX_TOKEN)
|
||||
.build());
|
||||
|
||||
try {
|
||||
ROOM_ID = joinResp.get("room_id")
|
||||
.asText();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to join matrix room.");
|
||||
System.err.println("Response: " + mapper.writeValueAsString(joinResp));
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
ROOM_ID = RequestUtils.getJsonNode(h2client, new Request.Builder()
|
||||
.url(MATRIX_SERVER + "/_matrix/client/v3/join/" + URLUtils.silentEncode(MATRIX_ROOM))
|
||||
|
|
Loading…
Reference in a new issue