Skip to content

Commit

Permalink
Change a few 'errors.New' to 'fmt.Errorf'
Browse files Browse the repository at this point in the history
These were not found by a linter but just something I noticed where it
would be better to include a bit more info.

Signed-off-by: Carlo Teubner <carlo@cteubner.net>
  • Loading branch information
c4rlo committed Dec 20, 2024
1 parent 010bfd1 commit 2c01f27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ func (s *Server) CheckHealth() health.State {
func (s *Server) tryGetBundle() error {
client, err := server_util.NewServerClient(s.config.BindLocalAddress)
if err != nil {
return errors.New("cannot create registration client")
return fmt.Errorf("cannot create registration client: %w", err)
}
defer client.Release()

Expand All @@ -531,7 +531,7 @@ func (s *Server) tryGetBundle() error {
// As currently coded however, the API isn't served until after
// the server CA has been signed by upstream.
if _, err := bundleClient.GetBundle(context.Background(), &bundlev1.GetBundleRequest{}); err != nil {
return errors.New("unable to fetch bundle")
return fmt.Errorf("unable to fetch bundle: %w", err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/setup/node-attestation/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func doX509popStep(ctx context.Context) error {

// Ban agent
if err := banAgent(ctx, client, svidResp.Id); err != nil {
return errors.New("failed to ban agent")
return fmt.Errorf("failed to ban agent: %w", err)
}

// Reattest banned agent, it MUST fail
Expand Down

0 comments on commit 2c01f27

Please sign in to comment.