Commit d6cc43b2 authored by Joe Rocklin's avatar Joe Rocklin Committed by Sander van Harmelen

Fix error names based on linter output

parent 5e1c7f37
...@@ -22,9 +22,9 @@ import ( ...@@ -22,9 +22,9 @@ import (
) )
var ( var (
UserBlockPreventedError = fmt.Errorf("Cannot block a user that is already blocked by LDAP synchronization") ErrUserBlockPrevented = fmt.Errorf("Cannot block a user that is already blocked by LDAP synchronization")
UserNotFoundError = fmt.Errorf("User does not exist") ErrUserNotFound = fmt.Errorf("User does not exist")
UserUnblockPreventedError = fmt.Errorf("Cannot unblock a user that is blocked by LDAP synchronization") ErrUserUnblockPrevented = fmt.Errorf("Cannot unblock a user that is blocked by LDAP synchronization")
) )
// UsersService handles communication with the user related methods of // UsersService handles communication with the user related methods of
...@@ -438,9 +438,9 @@ func (s *UsersService) BlockUser(user int, options ...OptionFunc) error { ...@@ -438,9 +438,9 @@ func (s *UsersService) BlockUser(user int, options ...OptionFunc) error {
case 201: case 201:
return nil return nil
case 403: case 403:
return UserBlockPreventedError return ErrUserBlockPrevented
case 404: case 404:
return UserNotFoundError return ErrUserNotFound
default: default:
return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode) return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
} }
...@@ -466,9 +466,9 @@ func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error { ...@@ -466,9 +466,9 @@ func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error {
case 201: case 201:
return nil return nil
case 403: case 403:
return UserUnblockPreventedError return ErrUserUnblockPrevented
case 404: case 404:
return UserNotFoundError return ErrUserNotFound
default: default:
return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode) return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
} }
......
...@@ -32,8 +32,8 @@ func TestBlockUser_UserNotFound(t *testing.T) { ...@@ -32,8 +32,8 @@ func TestBlockUser_UserNotFound(t *testing.T) {
}) })
err := client.Users.BlockUser(1) err := client.Users.BlockUser(1)
if err != UserNotFoundError { if err != ErrUserNotFound {
t.Errorf("Users.BlockUser error.\nExpected: %+v\n Got: %+v", UserNotFoundError, err) t.Errorf("Users.BlockUser error.\nExpected: %+v\n Got: %+v", ErrUserNotFound, err)
} }
} }
...@@ -47,8 +47,8 @@ func TestBlockUser_BlockPrevented(t *testing.T) { ...@@ -47,8 +47,8 @@ func TestBlockUser_BlockPrevented(t *testing.T) {
}) })
err := client.Users.BlockUser(1) err := client.Users.BlockUser(1)
if err != UserBlockPreventedError { if err != ErrUserBlockPrevented {
t.Errorf("Users.BlockUser error.\nExpected: %+v\n Got: %+v", UserBlockPreventedError, err) t.Errorf("Users.BlockUser error.\nExpected: %+v\n Got: %+v", ErrUserBlockPrevented, err)
} }
} }
...@@ -107,8 +107,8 @@ func TestUnblockUser_UserNotFound(t *testing.T) { ...@@ -107,8 +107,8 @@ func TestUnblockUser_UserNotFound(t *testing.T) {
}) })
err := client.Users.UnblockUser(1) err := client.Users.UnblockUser(1)
if err != UserNotFoundError { if err != ErrUserNotFound {
t.Errorf("Users.UnblockUser error.\nExpected: %+v\n Got: %+v", UserNotFoundError, err) t.Errorf("Users.UnblockUser error.\nExpected: %+v\n Got: %+v", ErrUserNotFound, err)
} }
} }
...@@ -122,8 +122,8 @@ func TestUnblockUser_UnblockPrevented(t *testing.T) { ...@@ -122,8 +122,8 @@ func TestUnblockUser_UnblockPrevented(t *testing.T) {
}) })
err := client.Users.UnblockUser(1) err := client.Users.UnblockUser(1)
if err != UserUnblockPreventedError { if err != ErrUserUnblockPrevented {
t.Errorf("Users.UnblockUser error.\nExpected: %+v\n Got: %+v", UserUnblockPreventedError, err) t.Errorf("Users.UnblockUser error.\nExpected: %+v\n Got: %+v", ErrUserUnblockPrevented, err)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment