From b0fac4559404c3d2d92e9dc1f5376d2d3e305ace Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 7 Apr 2021 00:14:13 +0300 Subject: [PATCH] Log error if makeIntent returns nil --- appservice/appservice.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/appservice/appservice.go b/appservice/appservice.go index d352c2d5..780cd242 100644 --- a/appservice/appservice.go +++ b/appservice/appservice.go @@ -167,6 +167,13 @@ func (as *AppService) makeIntent(userID id.UserID) *IntentAPI { localpart, homeserver, err := userID.Parse() if err != nil || len(localpart) == 0 || homeserver != as.HomeserverDomain { + if err != nil { + as.Log.Fatalfln("Failed to parse user ID %s: %v", userID, err) + } else if len(localpart) == 0 { + as.Log.Fatalfln("Failed to make intent for %s: localpart is empty", userID) + } else if homeserver != as.HomeserverDomain { + as.Log.Fatalfln("Failed to make intent for %s: homeserver isn't %s", userID, as.HomeserverDomain) + } return nil } intent = as.NewIntentAPI(localpart)