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

Surface nova errors message for bad request responses (400) #160

Merged
merged 3 commits into from
Jan 11, 2018

Conversation

databus23
Copy link
Member

gophercloud at the moment just returns a generic “bad request” error message when nova returns a status 400 response for a server create request.
But the response actually contains a detailed error message as to why the payload wasn’t accepted. (e.g. given image/flavor/key not found etc.)

There is a 1 year old upstream PR solving the same thing but unfortuantely its going nowhere: gophercloud/gophercloud#303

gophercloud at the moment just returns a generic “bad request” error message when nova returns a status 400 response for a server create request.
But the response actually contains a detailed error message as to why the payload wasn’t accepted. (e.g. given image/flavor/key not found etc.)

There is a 1 year old upstream PR solving the same thing but unfortuantely its going nowhere: gophercloud/gophercloud#303
@databus23 databus23 requested a review from BugRoger January 11, 2018 07:37
Copy link
Contributor

@BugRoger BugRoger left a comment

Choose a reason for hiding this comment

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

If i understand properly, this tries to turn the serialised json into a proper struct. I suppose this can't be generalised to do this always for all errors?

Would be cool to have this for all these Quota errors.

Otherwise LGTM.

}

func (ce createError) Error() string {
return "Failed to create server. This should not never be printed."
Copy link
Contributor

Choose a reason for hiding this comment

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

not never == always?

Copy link
Member Author

Choose a reason for hiding this comment

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

The deserialisation has to be defined for each error code. If quota errors result in a 400 bad request its already covered. If quota errors return something different we need to implement an additional interface for it.

Copy link
Member Author

@databus23 databus23 Jan 11, 2018

Choose a reason for hiding this comment

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

Ups. You got me. this doesn't make sense. one negation to much.

@databus23
Copy link
Member Author

So it seems quota errors are returned as 403 Forbidden.At the moment gophercloud doesn't support handling 403 errors with custom logic. :(

I opened an issue at gophercloud to get some feedback: gophercloud/gophercloud#713

@databus23 databus23 merged commit 1fef5cc into master Jan 11, 2018
@databus23 databus23 deleted the nova_bad_request branch January 11, 2018 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants