hashicorp / hashicorp/nomad

API client (Go) returns error on 404 rather than nil result

Open
#1,849 0 comments 2 reactions 0 assignees View on GitHub
theme/api type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version

Output from `nomad version`

0.4.1
### Operating system and Environment details

macOS
### Issue

When using the API client package in the `api` subdir, and making a request such as:

``` go
client.Jobs().Info("foo", nil)
```

where "foo" doesn't exist, it returns an error, rather than a nil job. This makes it difficult to differentiate between a real error and simply a non-existent job.
### Reproduction steps

The above states it.
### Nomad Server logs (if appropriate)

Not appropriate.
### Nomad Client logs (if appropriate)

Not appropriate.
### Job file (if appropriate)

None required.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the API client package under the api subdirectory and trace client.Jobs().Info("foo", nil) for a missing job. Reproduce the 404 case and verify that a nonexistent job produces a nil result without an error, while genuine errors remain distinguishable.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.