Skip to content

Commit

Permalink
Fix method signature in JsonWrapper and update error handling in HTTP…
Browse files Browse the repository at this point in the history
… server
  • Loading branch information
S0L0GUY committed Jan 27, 2025
1 parent 7a99c79 commit 8698d34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion classes/json_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def read_json(file_path):
data = json.load(file)
return json.dumps(data, indent=4)

def read_txt(file_path):
def read_txt(self, file_path):
"""
Reads a text file and returns its contents as a string.
Args:
Expand Down
7 changes: 5 additions & 2 deletions http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def logs():
str: The logs read from the history path.
"""

history_data = json_wrapper.JsonWrapper.read(
history_data = json_wrapper.JsonWrapper.read_json(
constant.FilePaths.HISTORY_PATH
)
logs = history_data.toString()
Expand Down Expand Up @@ -90,7 +90,10 @@ def do_GET(self):
try:
result = handle_command(command, *args)
self._send_response(result)
except Exception as e:
except (
FileNotFoundError,
ValueError
) as e:
self._send_response(f"Error: {str(e)}")

def start_server():
Expand Down

0 comments on commit 8698d34

Please sign in to comment.