wrap errors correctly

This commit is contained in:
2026-07-07 09:34:36 +02:00
parent 24038e36f7
commit 2f77c27715
22 changed files with 95 additions and 94 deletions

View File

@@ -30,7 +30,7 @@ func RoleNames(conf *cfg.Config) ([]string, error) {
res, err := conf.DefaultCluster.ES().Security.GetRole().
Do(context.Background())
if err != nil {
return nil, fmt.Errorf("failed to get roles: %s", esErrorString(err))
return nil, fmt.Errorf("failed to get roles: %w", esErrorString(err))
}
roles := make([]string, len(res))
@@ -47,7 +47,7 @@ func RoleList(conf *cfg.Config) error {
res, err := conf.DefaultCluster.ES().Security.GetRole().
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get roles: %s", esErrorString(err))
return fmt.Errorf("failed to get roles: %w", esErrorString(err))
}
slog.Debug("ES result", "roles", res)
@@ -74,7 +74,7 @@ func RoleShow(conf *cfg.Config, rolename string) error {
Name(rolename).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get role: %s", esErrorString(err))
return fmt.Errorf("failed to get role: %w", esErrorString(err))
}
slog.Debug("ES result", "role", res)