Skip to content

Commit

Permalink
If we don't have any TUF metadata locally, return friendlier error me…
Browse files Browse the repository at this point in the history
…ssage
  • Loading branch information
RebeccaMahany committed Oct 23, 2024
1 parent 4fe4194 commit ea79fa2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ee/tuf/library_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tuf

import (
"context"
"errors"
"fmt"
"log/slog"
"os"
Expand Down Expand Up @@ -248,7 +249,10 @@ func findExecutable(ctx context.Context, binary autoupdatableBinary, tufReposito
// From already-downloaded metadata, look for the release version
targets, err := metadataClient.Targets()
if err != nil {
return nil, fmt.Errorf("could not get target: %w", err)
return nil, fmt.Errorf("could not get targets: %w", err)
}
if len(targets) == 0 {
return nil, errors.New("no local TUF metadata available -- likely new install")
}

targetName, _, err := findTarget(ctx, binary, targets, pinnedVersion, channel, slogger)
Expand Down

0 comments on commit ea79fa2

Please sign in to comment.