-
Notifications
You must be signed in to change notification settings - Fork 536
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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)); |
There was a problem hiding this comment.
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
:
vertx-web/vertx-web/src/main/java/io/vertx/ext/web/handler/impl/CSRFHandlerImpl.java
Line 191 in 1007552
ctx.fail(403, new VertxException("Invalid Origin", true)); |
The build failure looks unrelated (same thing happened on the main branch). It should be gone after the PR has been updated and rebased 🤞 |
Thank you for the help! |
e32cd4b
to
0a91b7f
Compare
There was a problem hiding this 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.
vertx-web/src/main/java/io/vertx/ext/web/impl/RoutingContextImpl.java
Outdated
Show resolved
Hide resolved
vertx-web/src/main/java/io/vertx/ext/web/impl/RoutingContextImpl.java
Outdated
Show resolved
Hide resolved
3409a3e
to
aa58a59
Compare
vertx-web/src/main/java/io/vertx/ext/web/impl/RoutingContextImpl.java
Outdated
Show resolved
Hide resolved
vertx-web/src/main/java/io/vertx/ext/web/impl/RoutingContextImpl.java
Outdated
Show resolved
Hide resolved
vertx-web/src/main/java/io/vertx/ext/web/impl/RoutingContextImpl.java
Outdated
Show resolved
Hide resolved
Can you please rebase the PR? The fixes for the build failures have been pushed to the main branch. Thanks |
Motivation:
On Quarkus side we have the following issue quarkusio/quarkus#43936, the idea here is to improve the message error.