Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Gave CoinbaseError a more informative string representation
  • Loading branch information
sdobz committed Jan 7, 2014
commit 51c3bfeaec37efd201e2a4007497a80311a97382
6 changes: 6 additions & 0 deletions coinbase/models/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ class CoinbaseError(BaseException):

def __init__(self, errorList):
self.error = errorList

def __unicode__(self):
return 'CoinbaseError: {}'.format(unicode(self.error))

def __str__(self):
return 'CoinbaseError: {}'.format(str(self.error))
2 changes: 2 additions & 0 deletions coinbase/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def test_status_error(self):
self.account.balance
except CoinbaseError as e:
e.error.should.equal("Invalid api_key")
unicode(e).should.equal(u"CoinbaseError: Invalid api_key")
str(e).should.equal("CoinbaseError: Invalid api_key")
except Exception:
assert False

Expand Down