diff --git a/server/service/service_invites.go b/server/service/service_invites.go index e5db93de0..ef5d2ea29 100644 --- a/server/service/service_invites.go +++ b/server/service/service_invites.go @@ -2,7 +2,6 @@ package service import ( "encoding/base64" - "errors" kolide_errors "github.com/kolide/kolide-ose/server/errors" "github.com/kolide/kolide-ose/server/kolide" @@ -77,7 +76,7 @@ func (svc service) VerifyInvite(ctx context.Context, email, token string) error expiresAt := invite.CreatedAt.Add(svc.config.App.InviteTokenValidityPeriod) if svc.clock.Now().After(expiresAt) { - return errors.New("expired invite token") + return newInvalidArgumentError("invite_token", "Invite token has expired.") } return nil diff --git a/server/service/service_users_test.go b/server/service/service_users_test.go index 517aef350..4202538d7 100644 --- a/server/service/service_users_test.go +++ b/server/service/service_users_test.go @@ -165,7 +165,7 @@ func TestCreateUser(t *testing.T) { NeedsPasswordReset: boolPtr(true), Admin: boolPtr(false), InviteToken: &invites["expired"].Token, - wantErr: errors.New("expired invite token"), + wantErr: &invalidArgumentError{{name: "invite_token", reason: "Invite token has expired."}}, }, { Username: stringPtr("@admin2"),