Created
November 18, 2014 22:49
-
-
Save zackshapiro/ddead39f839b73a08a29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/models.order.rb | |
def sell_users_coins | |
begin | |
client = user.create_client | |
balance = user.balance(client) | |
# some code related to selling the actual bitcoins | |
# logic, edge case checks, etc. | |
rescue Coinbase::Error => e | |
if e.message == "You don't have that many bitcoins in your account to sell." | |
# do some stuff | |
end | |
ensure | |
user.update_credentials(client) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment