Skip to content

Commit c492b07

Browse files
committed
Simplify debugging by removing try-except blocks
1 parent 64ca9b0 commit c492b07

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

gonotego/settings/server.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,8 @@ def do_POST(self):
157157
parsed_path = urlparse(self.path)
158158

159159
# Early debug log to see if we're getting to this point
160-
try:
161-
with open('/tmp/wifi_debug_start.log', 'a') as f:
162-
f.write(f"POST request received to {parsed_path.path}\n")
163-
except Exception as e:
164-
print(f"Error writing to start debug log: {e}")
160+
with open('/tmp/wifi_debug_start.log', 'a') as f:
161+
f.write(f"POST request received to {parsed_path.path}\n")
165162

166163
if parsed_path.path == "/api/settings":
167164
try:
@@ -171,14 +168,11 @@ def do_POST(self):
171168
settings_data = json.loads(post_data)
172169

173170
# Write all settings being processed to debug file
174-
try:
175-
with open('/tmp/wifi_debug.log', 'a') as f:
176-
f.write("===== SETTINGS UPDATE =====\n")
177-
for k, v in settings_data.items():
178-
f.write(f"Key: {k}, Value type: {type(v)}, Value: {v}\n")
179-
f.write("========================\n")
180-
except Exception as e:
181-
print(f"Error writing to debug log: {e}")
171+
with open('/tmp/wifi_debug.log', 'a') as f:
172+
f.write("===== SETTINGS UPDATE =====\n")
173+
for k, v in settings_data.items():
174+
f.write(f"Key: {k}, Value type: {type(v)}, Value: {v}\n")
175+
f.write("========================\n")
182176

183177
# Update settings
184178
for key, value in settings_data.items():
@@ -196,11 +190,8 @@ def do_POST(self):
196190
if key == 'WIFI_NETWORKS':
197191
try:
198192
# Write debug info to a file that can be checked later
199-
try:
200-
with open('/tmp/wifi_debug.log', 'a') as f:
201-
f.write(f"WIFI_NETWORKS value type: {type(value)}, value: {value}\n")
202-
except Exception as e:
203-
print(f"Error writing to wifi debug log: {e}")
193+
with open('/tmp/wifi_debug.log', 'a') as f:
194+
f.write(f"WIFI_NETWORKS value type: {type(value)}, value: {value}\n")
204195
# Parse the value to ensure it's in the correct format
205196
if isinstance(value, str):
206197
networks = json.loads(value)

0 commit comments

Comments
 (0)