Skip to content

Release 20250926 : notify 参数检查#14

Merged
MistEO merged 1 commit intodevfrom
release/250926
Sep 25, 2025
Merged

Release 20250926 : notify 参数检查#14
MistEO merged 1 commit intodevfrom
release/250926

Conversation

@MistEO
Copy link
Copy Markdown
Contributor

@MistEO MistEO commented Sep 25, 2025

No description provided.

@MistEO MistEO changed the title fix: notify check invalid json Release 20250926 : notify 参数检查 Sep 25, 2025
@MistEO MistEO requested a review from Copilot September 25, 2025 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds parameter validation to the notify_admin endpoint by implementing JSON parsing error handling. The change ensures that invalid JSON requests are properly caught and return a 400 status code instead of potentially causing unhandled exceptions.

  • Added JSON parsing error handling with try-catch block
  • Imported HTTPException for proper error responses
  • Added logging for invalid JSON requests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

body = await request.json()
try:
body = await request.json()
except Exception as e:
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception handling is too broad. Consider catching specific JSON-related exceptions like json.JSONDecodeError or ValueError instead of the generic Exception to avoid masking other potential errors.

Copilot uses AI. Check for mistakes.
@MistEO MistEO merged commit 36bb160 into dev Sep 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants