More helpful error message when IP does not resolve for OLED screen (#541)

* More helpful error message

* Remove confusing fallback IP

* Tweak message
This commit is contained in:
Daniel Markstedt 2021-12-20 06:20:22 -08:00 committed by GitHub
parent 4ae273ccbd
commit 200bc7251f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@ def get_ip_and_host():
sock.connect(('10.255.255.255', 1))
ip_addr = sock.getsockname()[0]
except Exception:
ip_addr = '127.0.0.1'
ip_addr = False
finally:
sock.close()
return ip_addr, host

View File

@ -161,7 +161,11 @@ def formatted_output():
else:
output.append("No image mounted!")
output.append(f"IP {IP_ADDR} - {HOSTNAME}")
if IP_ADDR:
output.append(f"IP {IP_ADDR} - {HOSTNAME}")
else:
output.append("RaSCSI has no IP address")
output.append("Check network connection")
return output