Hey guys ,how u are implementing Exception handlin...
# vertx
c
Hey guys ,how u are implementing Exception handling in Vertx . I am more concerned to do Centralized Exception Handling in Vertx project Right now for every route we can have handler ,but not for every custom exception . So I want to map Custom Exception to Specific handler ,Is there better way to do it you can suggest So if i throw in any route handler get("/order") .coroutineHandler { orderHandlers.getOrders(it) } //Handler of above route suspend fun getOrders(ctx: RoutingContext) { throw InvalidJsonException("InValid Json Data ") ctx.response().end(json { obj("id" to 12, "getRating" to 324).encode() }) } This is caught by Failure handler of that route but for every Custom exception i have to do If else and the handle it . I think there should be better way to map Custom Exceptions to their handlers and send response back . Jooby Framework provide mapping of its own like this :- err(GenericSystemException::class.java, ::handleGenericSytemError) err(InvalidJSONInputException::class.java, ::handleInvalidJSONError) err(InputValidationException::class.java, ::handleInputValidationError) Need suggestion How it should be implemented in Vertx Project