Skip to content

Commit

Permalink
fix: add beep signal on error and format error
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Nov 22, 2024
1 parent b1205f4 commit caa257f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fhirsnake/watch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
import time

Expand All @@ -12,7 +13,12 @@

class FileChangeHandler(FileSystemEventHandler):
def __init__(
self, target_dir: str, external_fhir_server_url: str, external_fhir_server_headers: dict[str, str], *args, **kwargs
self,
target_dir: str,
external_fhir_server_url: str,
external_fhir_server_headers: dict[str, str],
*args,
**kwargs,
) -> None:
self.target_dir = target_dir
self.external_fhir_server_url = external_fhir_server_url
Expand Down Expand Up @@ -48,7 +54,11 @@ def process_file(self, file_path):
)
if response.status_code >= 400:
logging.error(
"Unable to update %s via %s (%s): %s", file_path, url, response.status_code, response.text
"Unable to update %s via %s (%s):\a\n %s",
file_path,
url,
response.status_code,
json.dumps(response.json(), indent=2),
)
else:
logging.info("Updated %s via %s (%s)", file_path, url, response.status_code)
Expand Down

0 comments on commit caa257f

Please sign in to comment.