Skip to content

Commit

Permalink
fix: enhance error messages with additional context
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerbxyz authored Sep 25, 2024
1 parent bafad8a commit 4c99eef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions github_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def create_a_tree(self, tree: list) -> dict:
response = session.post(url, json=data, headers=self.get_headers(), timeout=20)

if not response.ok:
print("Failed to create a tree")
print(f"Failed to create a tree: {data}")
print(response.json().get("message"))
response.raise_for_status()

Expand Down Expand Up @@ -287,7 +287,7 @@ def create_or_update_file_contents(
response = requests.put(url, json=data, headers=self.get_headers(), timeout=20)

if not response.ok:
print("Failed to create or update file contents")
print(f"Failed to create or update file contents: {data}")
print(response.json().get("message"))
response.raise_for_status()

Expand Down Expand Up @@ -320,7 +320,7 @@ def create_a_commit(self, message: str, tree_sha, parents: List[str]) -> dict:
response = requests.post(url, json=data, headers=self.get_headers(), timeout=20)

if not response.ok:
print("Failed to create a commit")
print(f"Failed to create a commit: {data}")
print(response.json().get("message"))
response.raise_for_status()

Expand Down Expand Up @@ -419,7 +419,7 @@ def update_a_reference(self, ref: str, sha):
)

if not response.ok:
print("Failed to update reference")
print(f"Failed to update reference: {data}")
print(response.json().get("message"))
response.raise_for_status()

Expand Down Expand Up @@ -472,7 +472,7 @@ def rename_file_or_directory(

content_response = self.get_repository_content(new_path)
if not content_response.ok:
print(f"Failed to get external metadata for renamed {guru_object_type}")
print(f"Failed to get external metadata for renamed {guru_object_type} ('{old_path}' → '{new_path}')")
print(content_response.json().get("message"))
content_response.raise_for_status()

Expand Down

0 comments on commit 4c99eef

Please sign in to comment.