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

Add a better message error on RoutingContextImpl #2677

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcruzdev
Copy link

@mcruzdev mcruzdev commented Nov 9, 2024

Motivation:

On Quarkus side we have the following issue quarkusio/quarkus#43936, the idea here is to improve the message error.

Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

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

Thank you @mcruzdev

This is a good improvement. Just one concern about the exception type.

String message = HttpVersion.HTTP_1_1 == request.version() ?
"For HTTP/1.x requests, the 'Host' header is required" :
"For HTTP/2 requests, the ':authority' pseudo-header is required";
fail(400, new IllegalStateException(message));
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think capturing a stacktrace is necessary in this case. In other places, for similar purpose, we use VertxException:

ctx.fail(403, new VertxException("Invalid Origin", true));

@tsegismont
Copy link
Contributor

The build failure looks unrelated (same thing happened on the main branch). It should be gone after the PR has been updated and rebased 🤞

@mcruzdev
Copy link
Author

Thank you for the help!

@mcruzdev mcruzdev force-pushed the no-authority-msg branch 2 times, most recently from e32cd4b to 0a91b7f Compare November 14, 2024 13:54
Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

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

Thank you for the updates @mcruzdev

A couple of suggestions, to avoid creating a redundant stack trace.

@tsegismont
Copy link
Contributor

Can you please rebase the PR? The fixes for the build failures have been pushed to the main branch. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants