Skip to content

Fix the error response model#122

Merged
pbrassel merged 1 commit into
mainfrom
fix-error-response
Jul 22, 2026
Merged

Fix the error response model#122
pbrassel merged 1 commit into
mainfrom
fix-error-response

Conversation

@pbrassel

@pbrassel pbrassel commented Jul 22, 2026

Copy link
Copy Markdown
Member

Make the error response model less strict because the structure of the payload for error responses varies.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when API responses omit a status code.
    • Error details now recognize both standard and camelCase status code formats.
    • Removed the unused error name field from error responses.

Make the error response model less strict because the structure of the payload for error responses varies.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

ErrorResponse now accepts optional status_code or statusCode values and no longer defines name. HTTP error parsing preserves payload status codes and falls back to the response status when absent.

Changes

Error response handling

Layer / File(s) Summary
Error response model and parsing
flame_hub/_exceptions.py
ErrorResponse removes name, accepts optional snake_case or camelCase status codes, and applies the HTTP response status only when the payload does not provide one.

Estimated code review effort: 2 (Simple) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change to the error response model and is concise.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-error-response

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.

@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.

🧹 Nitpick comments (1)
flame_hub/_exceptions.py (1)

4-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for both status-code aliases.

The existing tests cover HTTP fallback, but not status_code, statusCode, or preservation of a payload value that differs from r.status_code. Add focused cases for each alias and the fallback path.

Also applies to: 68-71

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flame_hub/_exceptions.py` around lines 4 - 12, Add focused regression tests
for ErrorResponse covering both status_code and statusCode validation aliases,
plus the HTTP fallback when neither is provided. Verify payload status values
are preserved even when they differ from r.status_code, while fallback behavior
still uses the response status code.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@flame_hub/_exceptions.py`:
- Around line 4-12: Add focused regression tests for ErrorResponse covering both
status_code and statusCode validation aliases, plus the HTTP fallback when
neither is provided. Verify payload status values are preserved even when they
differ from r.status_code, while fallback behavior still uses the response
status code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea17bfb6-6a6d-4890-a30e-8ba9ef7193c6

📥 Commits

Reviewing files that changed from the base of the PR and between 59c2124 and 597007f.

📒 Files selected for processing (1)
  • flame_hub/_exceptions.py

@pbrassel
pbrassel merged commit 85b72c8 into main Jul 22, 2026
7 checks passed
@pbrassel
pbrassel deleted the fix-error-response branch July 22, 2026 10:23
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.

1 participant