forked from bitshares/python-bitshares
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
36 lines (26 loc) · 682 Bytes
/
Copy pathexceptions.py
File metadata and controls
36 lines (26 loc) · 682 Bytes
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
import re
from grapheneapi.graphenewsrpc 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