Skip to content

Commit c9df480

Browse files
chore: update error type name
1 parent 0cd3be3 commit c9df480

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

coderd/notifications/enqueuer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ var (
2626
ErrDuplicate = xerrors.New("duplicate notification")
2727
)
2828

29-
type InvalidNotificationMethodError struct {
29+
type InvalidDefaultNotificationMethodError struct {
3030
Method string
3131
}
3232

33-
func (e InvalidNotificationMethodError) Error() string {
34-
return fmt.Sprintf("given notification method %q is invalid", e.Method)
33+
func (e InvalidDefaultNotificationMethodError) Error() string {
34+
return fmt.Sprintf("given default notification method %q is invalid", e.Method)
3535
}
3636

3737
type StoreEnqueuer struct {
@@ -54,7 +54,7 @@ func NewStoreEnqueuer(cfg codersdk.NotificationsConfig, store Store, helpers tem
5454
var method database.NotificationMethod
5555
// We do not allow setting Coder Inbox as the default method.
5656
if err := method.Scan(cfg.Method.String()); err != nil || method == database.NotificationMethodInbox {
57-
return nil, InvalidNotificationMethodError{Method: cfg.Method.String()}
57+
return nil, InvalidDefaultNotificationMethodError{Method: cfg.Method.String()}
5858
}
5959

6060
return &StoreEnqueuer{

coderd/notifications/notifications_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ func TestNotificationMethodCannotDefaultToInbox(t *testing.T) {
18691869
mClock.Set(time.Date(2024, 1, 15, 9, 0, 0, 0, time.UTC))
18701870

18711871
_, err := notifications.NewStoreEnqueuer(cfg, store, defaultHelpers(), logger.Named("enqueuer"), mClock)
1872-
require.ErrorIs(t, err, notifications.InvalidNotificationMethodError{Method: string(database.NotificationMethodInbox)})
1872+
require.ErrorIs(t, err, notifications.InvalidDefaultNotificationMethodError{Method: string(database.NotificationMethodInbox)})
18731873
}
18741874

18751875
func TestNotificationTargetMatrix(t *testing.T) {

0 commit comments

Comments
 (0)