Skip to content

fix: Improved bluesky.py error handling - #99

Merged
geeth24 merged 1 commit into
mainfrom
pranav/br-157-fullstack-quality-assurance
Dec 1, 2025
Merged

fix: Improved bluesky.py error handling#99
geeth24 merged 1 commit into
mainfrom
pranav/br-157-fullstack-quality-assurance

Conversation

@golanu814

@golanu814 golanu814 commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved error handling for missing disasters with proper HTTP 404 responses.
    • Fixed event time formatting in disaster responses to use standardized ISO 8601 format for better compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@golanu814
golanu814 requested a review from a team as a code owner December 1, 2025 21:37
@coderabbitai

coderabbitai Bot commented Dec 1, 2025

Copy link
Copy Markdown

Walkthrough

The pull request modifies error handling and data formatting in the Bluesky router. It replaces a dictionary error response with a proper HTTPException for 404 cases when a disaster is not found, and converts datetime objects to ISO 8601 strings for API serialization.

Changes

Cohort / File(s) Summary
Error handling and datetime serialization
server/routers/bluesky.py
Imports HTTPException and raises 404 errors instead of returning dictionary error responses; converts event_time field from raw datetime object to ISO 8601 string format (or None) for API responses

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Verify HTTPException import is correct and 404 status is appropriate for missing disaster cases
  • Confirm ISO 8601 string conversion handles None values correctly
  • Check if the datetime serialization change aligns with API contract expectations

Poem

🐰 A rabbit hopped through the code so neat,
Fixed errors and dates to make responses complete,
From dictionaries wild to exceptions so true,
ISO strings shine—the old datetime's through! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: improved error handling in bluesky.py, which aligns with the key changes of adding HTTPException and proper 404 error responses.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pranav/br-157-fullstack-quality-assurance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added bug Something isn't working version: patch 🐛 Bug fixes - bumps patch version (1.0.0 → 1.0.1) labels Dec 1, 2025
@github-actions

github-actions Bot commented Dec 1, 2025

Copy link
Copy Markdown

🐛 Version Bump Prediction

When this PR is merged to main, the version will be bumped:

1.49.01.49.1 (patch)


💡 How to change the version bump type

The version bump is determined by your commit messages and PR title:

  • Major (2.0.0): Use BREAKING CHANGE: or MAJOR: in title/commits
  • Minor (1.50.0): Use feat: or feature: in title/commits
  • Patch (1.49.1): Use fix:, chore:, docs:, etc.

What I analyzed:

  • PR Title: fix: Improved bluesky.py error handling
  • Commits: 1 commit(s)

Edit your PR title or commit messages to change the bump type.

@github-actions

github-actions Bot commented Dec 1, 2025

Copy link
Copy Markdown

🚀 Preview Deployment Ready!

Backend: https://api-pranav-br-157-fullstack-qualit.private.bluerelief.app
Frontend: https://pranav-br-157-fullstack-qualit.private.bluerelief.app
Email Service: https://email-api-pranav-br-157-fullstack-qualit.private.bluerelief.app

Commit: 9b00dff


🔐 Authentication

Demo Login: Click "Google Sign In" → Use demo auth (no Google account needed)
Demo Account: demo@bluerelief.test
Note: Google OAuth not available for preview domains. Demo mode enabled for testing.


✨ Version Bump Prediction

When this PR is merged to main, the version will be bumped:

1.49.01.49.1 (patch)

💡 How to change the version bump type

  • For patch: Use fix:, chore:, docs:, or ci: in commit messages
  • For minor: Use feat: or feature: in commit messages
  • For major: Include BREAKING CHANGE or breaking: in commit messages

Preview will be automatically deleted when PR is closed or merged.

@github-actions github-actions Bot added version: patch 🐛 Bug fixes - bumps patch version (1.0.0 → 1.0.1) and removed version: patch 🐛 Bug fixes - bumps patch version (1.0.0 → 1.0.1) labels Dec 1, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
server/routers/bluesky.py (1)

76-90: Improved 404 handling and datetime serialization look good; minor optional polish

  • Raising HTTPException(status_code=404, detail="Disaster not found") is the right FastAPI pattern and fixes the previous “error dict with 200 OK” behavior. This is a behavior change (404 vs 200), so just ensure any existing clients aren’t relying on the old success+error-body contract.
  • Converting event_time via disaster.event_time.isoformat() if disaster.event_time else None aligns with how other datetime fields are serialized and avoids potential JSON encoding issues.

If you want a tiny readability bump, you could use FastAPI’s status constant:

-from fastapi import APIRouter, Depends, HTTPException
+from fastapi import APIRouter, Depends, HTTPException
+from fastapi import status
@@
-    if not disaster:
-        raise HTTPException(status_code=404, detail="Disaster not found")
+    if not disaster:
+        raise HTTPException(
+            status_code=status.HTTP_404_NOT_FOUND,
+            detail="Disaster not found",
+        )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5572d1 and 4309283.

📒 Files selected for processing (1)
  • server/routers/bluesky.py (2 hunks)
🔇 Additional comments (1)
server/routers/bluesky.py (1)

1-1: HTTPException import is appropriate and matches usage

Importing HTTPException from FastAPI is correct here and is used directly in get_disaster; no issues with this change.

@geeth24
geeth24 merged commit af38e48 into main Dec 1, 2025
10 checks passed
@geeth24
geeth24 deleted the pranav/br-157-fullstack-quality-assurance branch December 1, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working version: patch 🐛 Bug fixes - bumps patch version (1.0.0 → 1.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants