1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Raise real errors in mocks

This commit is contained in:
Michael Hale 2015-07-02 18:08:27 -04:00
parent f8a8172520
commit 2a26069930
10 changed files with 17 additions and 14 deletions

View file

@ -32,7 +32,7 @@ module Fog
tags = options.delete("Tags")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
stream["Tags"] = stream["Tags"].merge(tags)

View file

@ -29,7 +29,7 @@ module Fog
stream_name = options.delete("StreamName")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
data[:kinesis_streams].delete(stream)

View file

@ -37,11 +37,11 @@ module Fog
starting_sequence_number = (shard_iterator["StartingSequenceNumber"] || 1).to_i
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
unless shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
raise 'unknown shard'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
end
records = []

View file

@ -37,7 +37,8 @@ module Fog
stream_name = options["StreamName"]
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
response = Excon::Response.new

View file

@ -37,7 +37,7 @@ module Fog
stream_name = options.delete("StreamName")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
response = Excon::Response.new

View file

@ -35,15 +35,17 @@ module Fog
adjacent_shard_to_merge_id = options.delete("AdjacentShardToMerge")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
unless shard_to_merge = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_to_merge_id }
raise 'unknown shard'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
end
unless adjacent_shard_to_merge = stream["Shards"].detect{ |shard| shard["ShardId"] == adjacent_shard_to_merge_id }
raise 'unknown shard'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
end
# Close shards (set an EndingSequenceNumber on them)

View file

@ -38,7 +38,7 @@ module Fog
stream_name = options.delete("StreamName")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
sequence_number = next_sequence_number

View file

@ -36,7 +36,7 @@ module Fog
def put_records(options={})
stream_name = options.delete("StreamName")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
records = options.delete("Records")

View file

@ -32,7 +32,7 @@ module Fog
tags = options.delete("TagKeys")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
stream["Tags"] = stream["Tags"].delete_if { |k,_| tags.include?(k) }

View file

@ -35,11 +35,11 @@ module Fog
stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
end
unless shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
raise 'unknown shard'
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
end
# Close original shard (set an EndingSequenceNumber on it)