Skip to content

Commit

Permalink
#81 better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 13, 2018
1 parent 5940f80 commit 22d59f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions objects/bank.rb
Expand Up @@ -18,6 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'backtrace'
require 'zold/log'
require 'coinbase/wallet'
require_relative 'user_error'
Expand All @@ -41,8 +42,11 @@ def initialize(key, secret, account, log: Zold::Log::NULL)
end

# Send BTC
def send(address, usd, description)
def send(address, usd, details)
acc = Coinbase::Wallet::Client.new(api_key: @key, api_secret: @secret).account(@account)
acc.send(to: address, amount: usd, currency: 'USD', description: description)
acc.send(to: address, amount: usd, currency: 'USD', description: details)
rescue StandardError => e
@log.error(Backtrace.new(e))
raise "Failed to send \"#{usd}\" to \"#{address}\" with details of \"#{details}\": #{e.message}"
end
end

0 comments on commit 22d59f7

Please sign in to comment.