mirror of
https://codeberg.org/prof_x_pvt_ltd/captive.whump.shanti-portal
synced 2024-08-14 22:46:42 +00:00
try with exception
This commit is contained in:
parent
f2b7784969
commit
6297b5abfd
1 changed files with 6 additions and 5 deletions
|
@ -69,14 +69,15 @@ class Client(object):
|
||||||
# count. Don't rely on it existing though.
|
# count. Don't rely on it existing though.
|
||||||
rule = None
|
rule = None
|
||||||
try:
|
try:
|
||||||
rule = self.find_rule(self.ip_address, self.protocol)
|
rule = self.find_rule(self._ip_address, self.protocol)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# TODO: This should raise an exception and be handled further up
|
# TODO: This should raise an exception and be handled further up
|
||||||
# the stack by logging the error.
|
# the stack by logging the error.
|
||||||
#raise IPTCRuleNotFound('Could not find the iptables rule for {client_ip}'.format(
|
raise IPTCRuleNotFound(
|
||||||
# client_ip=self.ip_address
|
'Could not find the iptables rule for {client_ip}'.format(
|
||||||
#))
|
client_ip=self.ip_address
|
||||||
return None
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if rule:
|
if rule:
|
||||||
(packet_count, byte_count) = rule.get_counters()
|
(packet_count, byte_count) = rule.get_counters()
|
||||||
|
|
Loading…
Reference in a new issue