1
0
Fork 0
mirror of https://codeberg.org/june64/mrvc.git synced 2026-01-09 15:52:53 +01:00

log additional informative infos when various errors are encountered

This commit is contained in:
June 2025-08-20 22:01:30 +02:00
commit 703b28b6fe
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
2 changed files with 6 additions and 0 deletions

View file

@ -19,11 +19,13 @@ func main() {
userId := id.UserID(config.UserID)
_, homeserver, err := userId.ParseAndValidate()
if err != nil {
log.Println("Error while parsing and validating the given user ID. Please ensure it is valid.")
log.Fatal(err)
}
clientWellKnown, err := mautrix.DiscoverClientAPI(context.Background(), homeserver)
if err != nil {
log.Println("Error while trying to discover the homeservers client API URL from the given user ID. Please ensure it is valid and its homeserver is correctly configured.")
log.Fatal(err)
}
homeserverURL := clientWellKnown.Homeserver.BaseURL

View file

@ -64,6 +64,7 @@ func resolveRooms(rooms []string, client *mautrix.Client) ([]id.RoomID, map[id.R
if strings.HasPrefix(room, "#") {
resolvedAlias, err := client.ResolveAlias(context.Background(), id.RoomAlias(room))
if err != nil {
log.Printf("Error resolving given alias (%s) to room ID.\n", room)
log.Fatal(err)
}
@ -109,6 +110,7 @@ func getChildRoomChunks(roomID id.RoomID, recursionMaxDepth *int, recursionSugge
for !finishedRequesting {
hierarchyResponse, err := client.Hierarchy(context.Background(), roomID, &hierarchyRequest)
if err != nil {
log.Printf("Error getting child rooms for given room (%s).\n", roomID)
log.Fatal(err)
}
@ -154,6 +156,7 @@ func getAliasesByRoomID(roomIDs []id.RoomID, client *mautrix.Client) map[id.Room
for _, roomID := range roomIDs {
aliasListResp, err := client.GetAliases(context.Background(), roomID)
if err != nil {
log.Printf("Error getting aliases for room (%s).\n", roomID)
log.Fatal(err)
}
@ -168,6 +171,7 @@ func getMembersByHomeserverByRoomID(roomIDs []id.RoomID, client *mautrix.Client)
for _, roomID := range roomIDs {
joinedMembers, err := client.JoinedMembers(context.Background(), roomID)
if err != nil {
log.Printf("Error getting members for room (%s).\n", roomID)
log.Fatal(err)
}
joinedMembersByRoomID[roomID] = joinedMembers