forked from bitshares/python-bitshares
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
50 lines (33 loc) · 851 Bytes
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import re
from grapheneapi.exceptions import RPCError
def decodeRPCErrorMsg(e):
""" Helper function to decode the raised Exception and give it a
python Exception class
"""
found = re.search(
(
"(10 assert_exception: Assert Exception\n|"
"3030000 tx_missing_posting_auth)"
".*: (.*)\n"
),
str(e),
flags=re.M,
)
if found:
return found.group(2).strip()
else:
return str(e)
class MissingRequiredActiveAuthority(RPCError):
pass
class NoMethodWithName(RPCError):
pass
class UnhandledRPCError(RPCError):
pass
class NumRetriesReached(Exception):
pass
class InvalidEndpointUrl(Exception):
pass
class AccountCouldntBeFoundException(Exception):
pass
class InvalidAccountNameException(Exception):
pass