Skip to content

Commit

Permalink
Introduce exception for unknown chainid (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Apr 8, 2019
1 parent 2595586 commit cb4772a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bitsharesapi/bitsharesnoderpc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import re

from bitsharesbase.chains import known_chains
Expand Down Expand Up @@ -35,7 +36,7 @@ def get_network(self):
for k, v in known_chains.items():
if v["chain_id"] == chain_id:
return v
raise Exception("Connecting to unknown network!")
raise exceptions.UnknownNetworkException("Connecting to unknown network!")

def get_account(self, name, **kwargs):
""" Get full account details from account name or id
Expand Down
8 changes: 8 additions & 0 deletions bitsharesapi/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import re

from grapheneapi.exceptions import RPCError
Expand Down Expand Up @@ -48,3 +49,10 @@ class AccountCouldntBeFoundException(Exception):

class InvalidAccountNameException(Exception):
pass


class UnknownNetworkException(Exception):
""" Thrown when we don't recognize the chain id
"""

pass

0 comments on commit cb4772a

Please sign in to comment.