From c3adbdbe57967a441556077b68f8048a808a71a6 Mon Sep 17 00:00:00 2001 From: John Behm Date: Mon, 22 Jan 2024 00:36:00 +0100 Subject: [PATCH] improve error messages --- dao/active_servers.go.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dao/active_servers.go.go b/dao/active_servers.go.go index c205e14..3c06444 100644 --- a/dao/active_servers.go.go +++ b/dao/active_servers.go.go @@ -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) @@ -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