Skip to content

Commit

Permalink
Adds error handling for client error in getRandomJobAlloc. (#10787)
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Rollins authored Jun 18, 2021
1 parent 6dcada4 commit c56251b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions command/alloc_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ func (f *AllocFSCommand) followFile(client *api.Client, alloc *api.Allocation,
func getRandomJobAlloc(client *api.Client, jobID string) (*api.AllocationListStub, error) {
var runningAllocs []*api.AllocationListStub
allocs, _, err := client.Jobs().Allocations(jobID, false, nil)
if err != nil {
return nil, fmt.Errorf("error querying job %q: %w", jobID, err)
}

// Check that the job actually has allocations
if len(allocs) == 0 {
Expand Down

0 comments on commit c56251b

Please sign in to comment.