Unable to catch MethodArgumentTypeMismatchException on doFilter()
I have a filter that basically logs incoming and outgoing information, but it seems that using this custom
RequestLoggingFilter implements Filter
creates a problem, I get MethodArgumentTypeMismatchException
when a request's URI is unmapped.
Error as follows:
I believe adding the non-existent URI "all" which I don't even map caused this problem. I find it weird since I could not catch the exception in:6 Replies
⌛
This post has been reserved for your question.
Hey @circle! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Somewhy it got filtered
on the catch, I have tried adding the exception and Exception, but the error could not be handled by my overridden doFilter() method.
It could only be handled by my global advice exception handlers, specifically the
MethodArgumentTypeMismatchException
handler, where I don't want that! I want it to return some kind of 404 since the handler is not foundIt never went through the
catch
. It is also important to see that the error came from the servlet handlers:I'd like a guide on this handling. Or is there a simpler approach? Such as denying the request with 404 (I'm trying to do that)
Severity: clogs the logger
Currently doing this goofy ahh handler:
Wait
Wait a minte\
maybe it's because it's trying to access GET
/api/products/{productId}
, but instead of Id, the provided thing was "all" which does not make sense and should throw that
teheePost Closed
This post has been closed by <@389034898666553344>.