Skip to content

Commit

Permalink
Log error if makeIntent returns nil
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Apr 6, 2021
1 parent 7f51495 commit b0fac45
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions appservice/appservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b0fac45

Please sign in to comment.