Hey guys, some time ago i have faced with issue in my spring-webflux + kotlin microservice. During api call, After some kind of exception thrown inside suspend controller’s function, i have no errors in logs about it and also my request is stuck(after few minutes i got timeout error on client side).
I have short example of issue
`@RestController @RequestMapping(“/test”)
class OrderController() {
Your catch block only catches Exception. NoClassDefFoundError is not a subclass of Exception. It is a subclass of LinkageError, which is a subclass of Error.
In JVM, the topmost class, that can be thrown, is called Throwable. JVM ships with two direct subclasses of Throwable: Exception and Error. According to the documentation: An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.
That said, I would expect Spring to catch any uncaught throwable (including errors), log it, and respond with status 500. I just tried that in a minimal project myself, and that was indeed what happened. Are you perhaps using an old version of Spring or WebFlux? At any rate, that would be a Spring issue, not a Kotlin issue.
@Varia thx for your answer, yep i thought that issue in spring, but i decided write about issue to kotlin forum first.
I using spring-boot 2.5.5 and kotlin 1.5.31.