Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return bad request if IllegalArgumentException #199

Merged
merged 4 commits into from
Oct 31, 2024
Merged

return bad request if IllegalArgumentException #199

merged 4 commits into from
Oct 31, 2024

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Oct 28, 2024

Close: #198

I am not sure if we should fix this in micronaut-session. I lean towards creating an ExeptionHandler in Micronaut-core for IllegalArgumentException. thoughts?

Close: #198
@sdelamo sdelamo added the type: improvement A minor improvement to an existing feature label Oct 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
}
} catch (IllegalArgumentException e) {
return Flux.error(new HttpStatusException(HttpStatus.BAD_REQUEST, e.getMessage()));
Copy link
Contributor

Choose a reason for hiding this comment

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

may as well just throw the exception

Copy link
Contributor Author

@sdelamo sdelamo Oct 30, 2024

Choose a reason for hiding this comment

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

that is what the user complains about.

@mancze :

Micronaut server should not return 500 Internal Server Error in case of malformed session cookie in the request. It is incorrectly formatted request which should be categorized as 4xx.

He thinks we should not return a 500 for a IllegalArgumentException and we should return a 400 or maybe a 422.

I think we should fix this in core with a new ExceptionHandler for IllegalArgumentException. What do you think @dstepanov ?

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…ter.java

Co-authored-by: Graeme Rocher <graeme.rocher@oracle.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…ssionFilter.java"

This reverts commit c56432f.
Copy link

@sdelamo sdelamo merged commit 13df24f into 4.5.x Oct 31, 2024
11 checks passed
@sdelamo sdelamo deleted the issue-198 branch October 31, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Unhandled exception in case of malformed session cookie (server returns 500 Internal Server Error)
2 participants