Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 8f683f7

Browse files
committed
fix(versions endpoint): add logging, handle broader range of exceptions, don't return raw error detail to client
1 parent bea209a commit 8f683f7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/codegate/dashboard/dashboard.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,23 @@ def version_check(client: AsyncClient = Depends(get_http_client)):
100100
"error": None,
101101
}
102102
except HTTPException as e:
103+
logger.error(f"HTTPException: {e.detail}")
103104
return {
104105
"current_version": __version__,
105106
"latest_version": "unknown",
106107
"is_latest": None,
107-
"error": e.detail
108+
"error": "Failed to fetch the latest version"
108109
}
110+
except Exception as e:
111+
logger.error(f"Unexpected error: {str(e)}")
112+
return {
113+
"current_version": __version__,
114+
"latest_version": "unknown",
115+
"is_latest": None,
116+
"error": "An unexpected error occurred"
117+
}
118+
finally:
119+
client.aclose()
109120

110121

111122
def generate_openapi():

0 commit comments

Comments
 (0)