Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit a25072c

Browse files
committed
exception.py: added __str__() to BridgeError and ClientError.
1 parent 34a64a4 commit a25072c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

storj/exception.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ def __init__(self, code='', message=''):
1616
self.code = code
1717
self.message = message
1818

19+
def __str__(self):
20+
"""Returns a string representation of this error.
21+
22+
Returns:
23+
str: string representation of this error.
24+
"""
25+
return '[%s] %s' % (self.code, self.message)
26+
1927

2028
class ClientError(RuntimeError):
2129
"""Storj client runtime exception.
@@ -29,6 +37,14 @@ def __init__(self, message=''):
2937

3038
self.message = message
3139

40+
def __str__(self):
41+
"""Returns a string representation of this error.
42+
43+
Returns:
44+
str: string representation of this error.
45+
"""
46+
return self.message
47+
3248

3349
class FarmerError(RuntimeError):
3450
"""Storj farmer runtime exception.

0 commit comments

Comments
 (0)