mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-19 12:36:06 +00:00
actions: Raise an exception if privileged server response is empty
- These situation occur when server encounters an error when trying to formulate a response. All exceptions during execution of actions are caught and reported properly. However, server may encounter errors during processing of exception raised in an action. Or may die abruptly. This special error will make identifying such situations easier. Tests: - Add a 'return' after _read_request() in privileged_daemon.py:RequestHandler:handle(). This will trigger this error. Starting FreedomBox service will show these errors as 'ConnectionError: Server returned empty response'. Similarly running 'freedombox-cmd --no-args plinth is_package_manager_busy' will show the same error. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
f19ab68553
commit
279738c305
@ -88,6 +88,9 @@ def _read_from_server(client_socket: socket.socket) -> bytes:
|
||||
|
||||
response += chunk
|
||||
|
||||
if not response:
|
||||
raise ConnectionError('Server returned empty response')
|
||||
|
||||
return json.loads(response)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user