Skip to content

Comments

Response with 500 on unhandled exceptions#669

Merged
jviotti merged 1 commit intomainfrom
internal-error
Feb 24, 2026
Merged

Response with 500 on unhandled exceptions#669
jviotti merged 1 commit intomainfrom
internal-error

Conversation

@jviotti
Copy link
Member

@jviotti jviotti commented Feb 24, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

@augmentcode
Copy link

augmentcode bot commented Feb 24, 2026

🤖 Augment PR Summary

Summary: Updates the server’s generic exception handler to return 500 Internal Server Error instead of 405 Method Not Allowed when an unhandled exception occurs.
Why: Aligns the HTTP status code with the actual failure mode (unexpected server-side error) so clients can react appropriately.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/server/server.cc">

<violation number="1" location="src/server/server.cc:301">
P2: Now that this catch block handles genuine internal server errors (500), returning `error.what()` directly in the response risks leaking sensitive internal details (file paths, library error messages, configuration info) to clients. For 500 responses, consider using a generic error message in the response and logging the detailed exception message server-side only.</violation>

<violation number="2" location="src/server/server.cc:301">
P1: This catch block only handles `std::exception`-derived types. If `dispatch` is marked `noexcept`, any non-`std::exception` throw (e.g., an integer, string, or third-party exception type) will bypass this handler and invoke `std::terminate`, crashing the server instead of returning a 500. Add a `catch (...)` clause after this block to fully cover unhandled exceptions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit d100ea7 into main Feb 24, 2026
5 checks passed
@jviotti jviotti deleted the internal-error branch February 24, 2026 20:03
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