diff --git a/lib/fog/aws/requests/ec2/delete_volume.rb b/lib/fog/aws/requests/ec2/delete_volume.rb index c05bf9bbd..2df4e3b5f 100644 --- a/lib/fog/aws/requests/ec2/delete_volume.rb +++ b/lib/fog/aws/requests/ec2/delete_volume.rb @@ -43,6 +43,7 @@ else } else response.status = 400 + raise(Fog::Errors.status_error(200, 400, response)) end response end diff --git a/lib/fog/aws/requests/ec2/release_address.rb b/lib/fog/aws/requests/ec2/release_address.rb index f2fd39132..a988fd782 100644 --- a/lib/fog/aws/requests/ec2/release_address.rb +++ b/lib/fog/aws/requests/ec2/release_address.rb @@ -38,6 +38,7 @@ else } else response.status = 400 + raise(Fog::Errors.status_error(200, 400, response)) end response end diff --git a/spec/aws/ec2/delete_volume_spec.rb b/spec/aws/ec2/delete_volume_spec.rb index deb35f110..b95f98497 100644 --- a/spec/aws/ec2/delete_volume_spec.rb +++ b/spec/aws/ec2/delete_volume_spec.rb @@ -13,4 +13,10 @@ describe 'EC2.create_volume' do actual.body['return'].should == true end + it "should raise a BadRequest error if volume does not exist" do + lambda { + @ec2.release_address('vol-00000000') + }.should raise_error(Fog::Errors::BadRequest) + end + end diff --git a/spec/aws/ec2/release_address_spec.rb b/spec/aws/ec2/release_address_spec.rb index 79f23ffe7..5e66267d3 100644 --- a/spec/aws/ec2/release_address_spec.rb +++ b/spec/aws/ec2/release_address_spec.rb @@ -13,4 +13,10 @@ describe 'EC2.release_address' do actual.body['return'].should == true end + it "should raise a BadRequest error if address does not exist" do + lambda { + @ec2.release_address('0.0.0.0') + }.should raise_error(Fog::Errors::BadRequest) + end + end