We now handle Faraday::ClientError differently in Chart#get than in all the other calls. Error handling should be moved into the base class and handled consistently everywhere.
@rodolfobandeira
Add a module ala
module IEX::Resources::Base
def self.symbol(symbol, &_block)
yield
rescue Faraday::ResourceNotFound => e
raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
rescue Faraday::ClientError => e
raise IEX::Errors::ClientError, e.response
end
end
Then extend other modules with it and use symbol do ... everywhere instead of explicitly rescue-ing exceptions.
We now handle Faraday::ClientError differently in Chart#get than in all the other calls. Error handling should be moved into the base class and handled consistently everywhere.
@rodolfobandeira
Add a module ala
Then
extend
other modules with it and usesymbol do ...
everywhere instead of explicitly rescue-ing exceptions.