mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-25 20:27:18 +02:00
RPI: some more changes to properly throw and catch exceptions
This commit is contained in:
parent
f332738ceb
commit
5cd2d70a9b
3 changed files with 16 additions and 7 deletions
|
@ -598,6 +598,9 @@ class InverterTransaction:
|
||||||
wait = True
|
wait = True
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
pass
|
pass
|
||||||
|
except BufferError as e:
|
||||||
|
print(f'Buffer error {e}')
|
||||||
|
pass
|
||||||
|
|
||||||
return wait
|
return wait
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,8 @@ def poll_inverter(inverter, do_init, retries=4):
|
||||||
dst=inverter_ser
|
dst=inverter_ser
|
||||||
)))
|
)))
|
||||||
response = None
|
response = None
|
||||||
try:
|
|
||||||
while com.rxtx():
|
while com.rxtx():
|
||||||
|
try:
|
||||||
response = com.get_payload()
|
response = com.get_payload()
|
||||||
payload_ttl = 0
|
payload_ttl = 0
|
||||||
except Exception as e_all:
|
except Exception as e_all:
|
||||||
|
@ -324,3 +324,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
except Exception as e:
|
||||||
|
print ('Exception catched: %s' % e)
|
||||||
|
raise
|
||||||
|
|
|
@ -265,7 +265,7 @@ class VzInverterOutput:
|
||||||
r = self.session.get(url)
|
r = self.session.get(url)
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
raise ValueError('Could not send request (%s)' % url)
|
raise ValueError('Could not send request (%s)' % url)
|
||||||
except ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
raise ValueError('Could not send request (%s)' % e)
|
raise ValueError('Could not send request (%s)' % e)
|
||||||
|
|
||||||
class VolkszaehlerOutputPlugin(OutputPluginFactory):
|
class VolkszaehlerOutputPlugin(OutputPluginFactory):
|
||||||
|
@ -300,4 +300,7 @@ class VolkszaehlerOutputPlugin(OutputPluginFactory):
|
||||||
serial = data["inverter_ser"]
|
serial = data["inverter_ser"]
|
||||||
if serial in self.inverters:
|
if serial in self.inverters:
|
||||||
output = self.inverters[serial]
|
output = self.inverters[serial]
|
||||||
|
try:
|
||||||
output.store_status(data, self.session)
|
output.store_status(data, self.session)
|
||||||
|
except ValueError as e:
|
||||||
|
print('Could not send data to volkszaehler instance: %s' % e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue