Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Better error message #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/exchange/external_api/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def rate from, to, opts={}
rate_from = rates[from]
rate_to = rates[to]

test_for_rates_and_raise_if_nil rate_from, rate_to, opts[:at]
test_for_rates_and_raise_if_nil [from, rate_from], [to, rate_to], opts[:at]

rate_to / rate_from
end
Expand Down Expand Up @@ -169,7 +169,7 @@ def to_hash! array
# @raise [NoRateError] An error indicating that there is no rate present when there is no rate present
#
def test_for_rates_and_raise_if_nil rate_from, rate_to, time=nil
raise NoRateError.new("No rates where found for #{rate_from} to #{rate_to} #{'at ' + time.to_s if time}") unless rate_from && rate_to
raise NoRateError.new("No rates where found for #{rate_from[0]} to #{rate_to[0]} #{'at ' + time.to_s if time}") unless rate_from[1] && rate_to[1]
end

protected
Expand Down