Skip to content

Commit 41fd1d6

Browse files
Avoid sending reconnect message when zoom API overload causes error (#433)
* Avoid sending reconnect message when zoom API overload causes error * fix error matching
1 parent 1d794c2 commit 41fd1d6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/zoom/oauth.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const (
2424
zoomEmailMismatch = "We could not verify your Mattermost account in Zoom. Please ensure that your Mattermost email address %s matches your Zoom login email address."
2525
)
2626

27+
var ErrFetchingUser = errors.New("error returned while fetching Zoom user")
28+
2729
// OAuthUserInfo represents a Zoom user authenticated via OAuth.
2830
type OAuthUserInfo struct {
2931
ZoomEmail string
@@ -59,6 +61,10 @@ func (c *OAuthClient) GetUser(user *model.User, firstConnect bool) (*User, *Auth
5961
return nil, &AuthError{fmt.Sprintf("Error fetching user: %s", err), err}
6062
}
6163

64+
if errors.Is(err, ErrFetchingUser) {
65+
return nil, &AuthError{"Error fetching user from Zoom", err}
66+
}
67+
6268
return nil, &AuthError{fmt.Sprintf(OAuthPrompt, c.siteURL), err}
6369
}
6470

@@ -195,7 +201,7 @@ func (c *OAuthClient) getUserViaOAuth(user *model.User, firstConnect bool) (*Use
195201
}
196202

197203
if res.StatusCode != http.StatusOK {
198-
return nil, fmt.Errorf("%d error returned while fetching Zoom user", res.StatusCode)
204+
return nil, fmt.Errorf("%d %w", res.StatusCode, ErrFetchingUser)
199205
}
200206

201207
buf := new(bytes.Buffer)

0 commit comments

Comments
 (0)