Add exception type in HandleSendMessage and HandleSendBroadcast
and API error 14 in HandleSendBroadcast.
This commit is contained in:
parent
f311d9d25c
commit
e12e9c4155
12
src/api.py
12
src/api.py
|
@ -1118,9 +1118,8 @@ class BMRPCDispatcher(object):
|
||||||
fromAddress = addBMIfNotPresent(fromAddress)
|
fromAddress = addBMIfNotPresent(fromAddress)
|
||||||
self._verifyAddress(fromAddress)
|
self._verifyAddress(fromAddress)
|
||||||
try:
|
try:
|
||||||
fromAddressEnabled = self.config.getboolean(
|
fromAddressEnabled = self.config.getboolean(fromAddress, 'enabled')
|
||||||
fromAddress, 'enabled')
|
except ConfigParser.NoSectionError:
|
||||||
except BaseException:
|
|
||||||
raise APIError(
|
raise APIError(
|
||||||
13, 'Could not find your fromAddress in the keys.dat file.')
|
13, 'Could not find your fromAddress in the keys.dat file.')
|
||||||
if not fromAddressEnabled:
|
if not fromAddressEnabled:
|
||||||
|
@ -1164,10 +1163,13 @@ class BMRPCDispatcher(object):
|
||||||
fromAddress = addBMIfNotPresent(fromAddress)
|
fromAddress = addBMIfNotPresent(fromAddress)
|
||||||
self._verifyAddress(fromAddress)
|
self._verifyAddress(fromAddress)
|
||||||
try:
|
try:
|
||||||
self.config.getboolean(fromAddress, 'enabled')
|
fromAddressEnabled = self.config.getboolean(fromAddress, 'enabled')
|
||||||
except BaseException:
|
except ConfigParser.NoSectionError:
|
||||||
raise APIError(
|
raise APIError(
|
||||||
13, 'Could not find your fromAddress in the keys.dat file.')
|
13, 'Could not find your fromAddress in the keys.dat file.')
|
||||||
|
if not fromAddressEnabled:
|
||||||
|
raise APIError(14, 'Your fromAddress is disabled. Cannot send.')
|
||||||
|
|
||||||
toAddress = str_broadcast_subscribers
|
toAddress = str_broadcast_subscribers
|
||||||
|
|
||||||
ackdata = helper_sent.insert(
|
ackdata = helper_sent.insert(
|
||||||
|
|
Reference in New Issue
Block a user