Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing an error if ports are not named instead of crashing while parsing a job spec #604

Merged
merged 2 commits into from
Dec 18, 2015

Conversation

diptanu
Copy link
Contributor

@diptanu diptanu commented Dec 18, 2015

Nomad currently panics if ports are not named. This change makes Nomad throw an error instead which might be more comprehendable for an user.

Fixes #603

@diptanu diptanu changed the title Throwing an error if ports are not named Throwing an error if ports are not named instead of crashing while parsing a job spec Dec 18, 2015
@c4milo
Copy link
Contributor

c4milo commented Dec 18, 2015

Much better than a panic. Thank you! 👍

@@ -623,6 +623,9 @@ func parsePorts(networkObj *ast.ObjectList, nw *structs.NetworkResource) error {
portsObjList := networkObj.Filter("port")
knownPortLabels := make(map[string]bool)
for _, port := range portsObjList.Items {
if len(port.Keys) == 0 {
return fmt.Errorf("Nomad expects ports to be named")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make the message. "ports must be named". They know its from Nomad :)

diptanu added a commit that referenced this pull request Dec 18, 2015
Throwing an error if ports are not named instead of crashing while parsing a job spec
@diptanu diptanu merged commit a3af91a into master Dec 18, 2015
@diptanu diptanu deleted the f-port-err-msg branch December 18, 2015 20:07
@diptanu
Copy link
Contributor Author

diptanu commented Dec 18, 2015

hotfixed error message on master.

@github-actions
Copy link

github-actions bot commented May 1, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants