update
This commit is contained in:
@@ -69,7 +69,7 @@ class GiteaClient:
|
||||
if self.client:
|
||||
await self.client.aclose()
|
||||
|
||||
def _handle_response(self, response: Response, correlation_id: str) -> Dict[str, Any]:
|
||||
def _handle_response(self, response: Response, correlation_id: str) -> Any:
|
||||
"""Handle Gitea API response and raise appropriate exceptions.
|
||||
|
||||
Args:
|
||||
@@ -148,12 +148,12 @@ class GiteaClient:
|
||||
|
||||
return user_data
|
||||
|
||||
except Exception as e:
|
||||
except Exception as exc:
|
||||
self.audit.log_tool_invocation(
|
||||
tool_name="get_current_user",
|
||||
correlation_id=correlation_id,
|
||||
result_status="error",
|
||||
error=str(e),
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
@@ -177,7 +177,7 @@ class GiteaClient:
|
||||
try:
|
||||
response = await self.client.get("/api/v1/user/repos")
|
||||
repos_data = self._handle_response(response, correlation_id)
|
||||
|
||||
|
||||
# Ensure we have a list
|
||||
repos = repos_data if isinstance(repos_data, list) else []
|
||||
|
||||
@@ -190,12 +190,12 @@ class GiteaClient:
|
||||
|
||||
return repos
|
||||
|
||||
except Exception as e:
|
||||
except Exception as exc:
|
||||
self.audit.log_tool_invocation(
|
||||
tool_name="list_repositories",
|
||||
correlation_id=correlation_id,
|
||||
result_status="error",
|
||||
error=str(e),
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
@@ -236,13 +236,13 @@ class GiteaClient:
|
||||
|
||||
return repo_data
|
||||
|
||||
except Exception as e:
|
||||
except Exception as exc:
|
||||
self.audit.log_tool_invocation(
|
||||
tool_name="get_repository",
|
||||
repository=repo_id,
|
||||
correlation_id=correlation_id,
|
||||
result_status="error",
|
||||
error=str(e),
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
@@ -314,14 +314,14 @@ class GiteaClient:
|
||||
|
||||
return file_data
|
||||
|
||||
except Exception as e:
|
||||
except Exception as exc:
|
||||
self.audit.log_tool_invocation(
|
||||
tool_name="get_file_contents",
|
||||
repository=repo_id,
|
||||
target=filepath,
|
||||
correlation_id=correlation_id,
|
||||
result_status="error",
|
||||
error=str(e),
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
@@ -370,12 +370,12 @@ class GiteaClient:
|
||||
|
||||
return tree_data
|
||||
|
||||
except Exception as e:
|
||||
except Exception as exc:
|
||||
self.audit.log_tool_invocation(
|
||||
tool_name="get_tree",
|
||||
repository=repo_id,
|
||||
correlation_id=correlation_id,
|
||||
result_status="error",
|
||||
error=str(e),
|
||||
error=str(exc),
|
||||
)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user