You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Spring WebFlux application where sometimes the client closed the connection while the app is writing the response. This cause a io.netty.channel.StacklessClosedChannelException. From the log I see that this is logged as an ERROR by the AdviceTraits.java.
Since I do not want to see this error in the log (which triggers an alert) because is not an application error, it's just a client behaviour that I cannot avoid, I'd like to skip/capture the exception.
Which is then implemented by my ExceptionHandling:
@ControllerAdviceclassExceptionHandlingimplementsProblemHandling, SecurityAdviceTrait, ClosedChannelExceptionAdviceTrait {
// some code...
}
The problem is that nothing changed, the exception is still logged as an error by the AdviceTraits.
I had the same problem with Spring MVC (here I'm not using this library though) and I resolved by just having this method in my @ControllerAdvice:
@ExceptionHandler(ClientAbortException.class) // the exception is different because the web engine is not nettyprivatevoidclientAbortException() {
log.warn("Client closed connection!");
}
And it works.
While I was able to replicate the error locally in Spring MVC, I didn't find a way to replicate it for Spring WebFlux.
Is there a way to solve this problem without modifying the AdviceTraits.java class (which I cannot do)?
The text was updated successfully, but these errors were encountered:
I have a Spring WebFlux application where sometimes the client closed the connection while the app is writing the response. This cause a
io.netty.channel.StacklessClosedChannelException
. From the log I see that this is logged as an ERROR by the AdviceTraits.java.Since I do not want to see this error in the log (which triggers an alert) because is not an application error, it's just a client behaviour that I cannot avoid, I'd like to skip/capture the exception.
I tried to create a custom Trait:
Which is then implemented by my
ExceptionHandling
:The problem is that nothing changed, the exception is still logged as an error by the
AdviceTraits
.I had the same problem with Spring MVC (here I'm not using this library though) and I resolved by just having this method in my
@ControllerAdvice
:And it works.
While I was able to replicate the error locally in Spring MVC, I didn't find a way to replicate it for Spring WebFlux.
Is there a way to solve this problem without modifying the
AdviceTraits.java
class (which I cannot do)?The text was updated successfully, but these errors were encountered: