Skip to content

Commit bee3113

Browse files
authored
Merge pull request #59 from systemli/Update-error-handling-in-Userli-methods
🐛 Update error handling in Userli methods
2 parents 2dc6ae1 + d4e7273 commit bee3113

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

userli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (u *Userli) GetAliases(ctx context.Context, email string) ([]string, error)
131131
sanitizedEmail, err := u.sanitizeEmail(email)
132132
if err != nil {
133133
log.WithError(err).WithField("email", email).Info("unable to process the alias")
134-
return []string{}, err
134+
return []string{}, nil
135135
}
136136

137137
resp, err := u.call(ctx, fmt.Sprintf("%s/api/postfix/alias/%s", u.baseURL, sanitizedEmail))
@@ -170,7 +170,7 @@ func (u *Userli) GetMailbox(ctx context.Context, email string) (bool, error) {
170170
sanitizedEmail, err := u.sanitizeEmail(email)
171171
if err != nil {
172172
log.WithError(err).WithField("email", email).Info("unable to process the mailbox")
173-
return false, err
173+
return false, nil
174174
}
175175

176176
resp, err := u.call(ctx, fmt.Sprintf("%s/api/postfix/mailbox/%s", u.baseURL, sanitizedEmail))
@@ -192,7 +192,7 @@ func (u *Userli) GetSenders(ctx context.Context, email string) ([]string, error)
192192
sanitizedEmail, err := u.sanitizeEmail(email)
193193
if err != nil {
194194
log.WithError(err).WithField("email", email).Info("unable to process the senders")
195-
return []string{}, err
195+
return []string{}, nil
196196
}
197197

198198
resp, err := u.call(ctx, fmt.Sprintf("%s/api/postfix/senders/%s", u.baseURL, sanitizedEmail))

userli_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (s *UserliTestSuite) TestGetAliases() {
4545

4646
s.Run("no email", func() {
4747
aliases, err := s.userli.GetAliases(context.Background(), "alias")
48-
s.Error(err)
48+
s.NoError(err)
4949
s.Empty(aliases)
5050
})
5151

@@ -134,7 +134,7 @@ func (s *UserliTestSuite) TestGetMailbox() {
134134

135135
s.Run("no email", func() {
136136
active, err := s.userli.GetMailbox(context.Background(), "user")
137-
s.Error(err)
137+
s.NoError(err)
138138
s.False(active)
139139
})
140140

@@ -190,7 +190,7 @@ func (s *UserliTestSuite) TestGetSenders() {
190190

191191
s.Run("no email", func() {
192192
senders, err := s.userli.GetSenders(context.Background(), "user")
193-
s.Error(err)
193+
s.NoError(err)
194194
s.Empty(senders)
195195
})
196196

0 commit comments

Comments
 (0)