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

Fix stubbing errors with 'query' protocol #873

Merged
merged 1 commit into from
Jul 21, 2015

Conversation

ktheory
Copy link
Contributor

@ktheory ktheory commented Jul 14, 2015

I noticed this wasn't working:

c = Aws::CloudFormation::Client.new(stub_responses: {validate_template: 'ValidationError'})
c.validate_template(template_body: '')
# => nil

The expected result is to raise an Aws::CloudFormation::Errors::ValidationError. 🐛 🚨

Turns out CloudFormation uses the query protocol, and the Aws::Stubbing::Protocols::Query#build_error method was blank.

YOLO?

I literally copied the method from RestXml#stub_error. 🙀 There's probably a better way.

There are no tests. 🙅

Now you can do the following:

```
c = Aws::CloudFormation::Client.new(stub_responses: {validate_template:
'ValidationError'})
c.validate_template(template_body: '')
```

This used to return `nil`. Now it raises
Aws::CloudFormation::Errors::ValidationError like you’d expect.
@trevorrowe
Copy link
Member

Thanks, I'll merge this then DRY it up.

trevorrowe added a commit that referenced this pull request Jul 21, 2015
Fix stubbing errors with 'query' protocol
@trevorrowe trevorrowe merged commit 0143200 into aws:master Jul 21, 2015
trevorrowe added a commit that referenced this pull request Jul 21, 2015
@ktheory
Copy link
Contributor Author

ktheory commented Jul 22, 2015

Thanks, @trevorrowe. You rock!

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