Open JWesorick opened 9 years ago
@JWesorick I agree with making some changes here to better catch this error.
With that being said, this is also the result of manually building hrefs, which we ask API consumers not to do. You should store and use the href
attribute supplied in API responses and not manually build them with stored IDs.
Did happen for me. :smile:
So this exception wan't super helpful and also, despite what the exception says, it did happen. I was making a call to fetch a bank account:
Balanced::BankAccount.fetch("/bank_accounts/#{bank_account_id}")
where
bank_account_id = nil
. I understand the error is that the id is nil, but it seems like it should either be caught earlier or have a better exception message.https://github.com/balanced/balanced-ruby/blob/master/lib/balanced/resources/resource.rb#L243