Skip to content

Conversation

@ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Sep 25, 2025

closes #11436

Summary by CodeRabbit

  • New Features
    • Standardized API error responses to return consistent, richer problem details in JSON.
  • Refactor
    • Unified error serialization path for more reliable and predictable responses across authentication failures and exceptions.
  • Chores
    • Streamlined JSON serialization context by removing unused types, reducing overhead.

@coderabbitai
Copy link

coderabbitai bot commented Sep 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Replaces ProblemDetails serialization with AppProblemDetails in the server exception handler. Updates the JSON source-generation context by removing ProblemDetails from JsonSerializable types. Control flow for status codes, auth redirect, and exception handling remains unchanged.

Changes

Cohort / File(s) Summary of Changes
Exception handling serialization update
.../Server/Boilerplate.Server.Api/Services/ServerExceptionHandler.cs
Switched response serialization to write AppProblemDetails via WriteAsJsonAsync; preserved existing status code handling, auth redirect logic, and exception flow.
JSON context adjustments
.../Server/Boilerplate.Server.Api/Services/ServerJsonContext.cs
Removed JsonSerializable attribute for ProblemDetails from source-generated JSON context; minor non-functional header change.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client
    participant API as Server API
    participant EH as ServerExceptionHandler
    participant JSON as JSON Serializer

    Client->>API: HTTP request
    API->>EH: Exception thrown
    EH->>EH: Map exception to status code
    alt Authentication failure
        EH->>Client: Redirect to auth
    else Other errors
        EH->>EH: Create AppProblemDetails
        EH->>JSON: WriteAsJsonAsync(AppProblemDetails)
        JSON-->>Client: HTTP response (JSON, status code)
    end

    note over EH,JSON: Changed: ProblemDetails -> AppProblemDetails payload type
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my whiskers at tidy tales,
Problem turns to App—no failing trails.
JSON hums a softer tune,
Server sings in stable rune.
With hops of joy, I ship the fix—
A nibble of code, no rabbit tricks.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4d01c9b and 72f9b4a.

📒 Files selected for processing (2)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Services/ServerExceptionHandler.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Services/ServerJsonContext.cs (1 hunks)

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.

@ysmoradi ysmoradi merged commit d6a6ca1 into bitfoundation:develop Sep 25, 2025
2 of 3 checks passed
@ysmoradi ysmoradi deleted the 11436 branch September 25, 2025 13:16
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.

ProblemDetails has to be replaced with AppProblemDetails that works in both Client/Server in bit Boilerplate

1 participant