java.lang.IllegalStateException: Response is closed
at io.vertx.core.http.impl.HttpServerResponseImpl.checkValid(HttpServerResponseImpl.java:547)
at io.vertx.core.http.impl.HttpServerResponseImpl.end0(HttpServerResponseImpl.java:400)
at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:318)
at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:307)
at fr.sewatech.vertx.HttpVerticle.lambda$response$8(HttpVerticle.java:75)
if (!response.closed())
response.end();
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/98254441-b78e-464f-80e2-47686a8631dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks Thomas,
Now I don't feel alone ;)
I think that with a router, I'll be able to make better code.
I'll add an failureHandler that will catch this kind of exception.
Le lundi 19 mars 2018 11:33:03 UTC+1, Thomas Segismont a écrit :
I can't think of a better way than what you described.Someone in the community already commented there that the solution could be inconvenient.Perhaps you could second that comment?
2018-03-19 9:24 GMT+01:00 Alexis Hassler <alexis....@gmail.com>:
When a client like a browser cancels its request, it closes the HTTP response.
And when I call response.end(), I'm getting this error :java.lang.IllegalStateException: Response is closed
at io.vertx.core.http.impl.HttpServerResponseImpl.checkValid(HttpServerResponseImpl.java:547)
at io.vertx.core.http.impl.HttpServerResponseImpl.end0(HttpServerResponseImpl.java:400)
at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:318)
at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:307)
at fr.sewatech.vertx.HttpVerticle.lambda$response$8(HttpVerticle.java:75)
As I don't want to see clients canceling requests as errors in my logs, I would like to deal with this errors in a better way.
For now, the only solution that I found is to check whether the response is closed before the end() :if (!response.closed())
response.end();
Adding if here and there is not my favorite way of coding.
Is there a better way to do it ?
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/98254441-b78e-464f-80e2-47686a8631dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/03f952cb-b825-45dc-b5ae-b2a3d0b1b250%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/CACiEr_TZWopzWYQUV4n_XDxyXyNHXQon5YmhZ%3D2_BoVRieJAKA%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ve...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/03f952cb-b825-45dc-b5ae-b2a3d0b1b250%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ve...@googlegroups.com.