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

Change to use new Excon::Errors::HTTPStatusError class

This commit is contained in:
Nathan Sutton 2010-11-30 12:07:47 +08:00 committed by Wesley Beary
parent 6d908f888b
commit ee4f95e4ce
8 changed files with 8 additions and 8 deletions

View file

@ -219,7 +219,7 @@ module Fog
:method => 'POST', :method => 'POST',
:parser => parser :parser => parser
}) })
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/) if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
raise case match[1].split('.').last raise case match[1].split('.').last
when 'NotFound' when 'NotFound'

View file

@ -68,7 +68,7 @@ module Fog
begin begin
response = @connection.request(params.merge!({:host => @host})) response = @connection.request(params.merge!({:host => @host}))
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Bluebox::Compute::NotFound.slurp(error) Fog::Bluebox::Compute::NotFound.slurp(error)

View file

@ -81,7 +81,7 @@ module Fog
response = @connection.request( response = @connection.request(
params.merge!(:path => "#{@path}/#{params[:path]}") params.merge!(:path => "#{@path}/#{params[:path]}")
) )
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::GoGrid::Compute::NotFound.slurp(error) Fog::GoGrid::Compute::NotFound.slurp(error)

View file

@ -70,7 +70,7 @@ module Fog
begin begin
response = @connection.request(params.merge!({:host => @host})) response = @connection.request(params.merge!({:host => @host}))
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::NewServers::Compute::NotFound.slurp(error) Fog::NewServers::Compute::NotFound.slurp(error)

View file

@ -61,7 +61,7 @@ module Fog
:host => @host, :host => @host,
:path => "#{@path}/#{params[:path]}", :path => "#{@path}/#{params[:path]}",
})) }))
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Rackspace::Storage::NotFound.slurp(error) Fog::Rackspace::Storage::NotFound.slurp(error)

View file

@ -92,7 +92,7 @@ module Fog
:host => @host, :host => @host,
:path => "#{@path}/#{params[:path]}" :path => "#{@path}/#{params[:path]}"
})) }))
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Rackspace::Compute::NotFound.slurp(error) Fog::Rackspace::Compute::NotFound.slurp(error)

View file

@ -111,7 +111,7 @@ module Fog
:host => @host, :host => @host,
:path => "#{@path}/#{params[:path]}", :path => "#{@path}/#{params[:path]}",
}), &block) }), &block)
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Rackspace::Storage::NotFound.slurp(error) Fog::Rackspace::Storage::NotFound.slurp(error)

View file

@ -73,7 +73,7 @@ module Fog
begin begin
response = @connection.request(params.merge!({:host => @host})) response = @connection.request(params.merge!({:host => @host}))
rescue Excon::Errors::Error => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Slicehost::Compute::NotFound.slurp(error) Fog::Slicehost::Compute::NotFound.slurp(error)