Skip to content

Commit

Permalink
improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jxsl13 committed Jan 21, 2024
1 parent f8f1514 commit c3adbdb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dao/active_servers.go.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
func (dao *DAO) ChangedServers(ctx context.Context) (_ map[model.MessageTarget]model.ChangedServerStatus, err error) {
previousServers, err := dao.PrevActiveServers(ctx)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get previous active servers: %w", err)
}

currentServers, err := dao.ActiveServers(ctx)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get current active servers: %w", err)
}

changedServers := make(map[model.MessageTarget]model.ChangedServerStatus, 64)
Expand Down Expand Up @@ -63,27 +63,27 @@ func (dao *DAO) ChangedServers(ctx context.Context) (_ map[model.MessageTarget]m
}
err = dao.removePrevActiveServers(ctx, messageIDs)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to remove previous active servers: %w", err)
}

err = dao.removePrevActiveClients(ctx, messageIDs)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to remove previous active clients: %w", err)
}

err = dao.addPrevActiveServers(ctx, added)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to add previous active servers: %w", err)
}

err = dao.addPrevActiveClients(ctx, added)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to add previous active clients: %w", err)
}

changedServers, err = dao.GetTargetListNotifications(ctx, changedServers)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get target list notifications: %w", err)
}

return changedServers, nil
Expand Down

0 comments on commit c3adbdb

Please sign in to comment.