When I define a route (snippet) like this:
.doTry()
.choice()
.when(header("s").isEqualTo(1))
.log(LoggingLevel.WARN, "normal")
.endChoice()
.doCatch(Exception.class)
.log(LoggingLevel.WARN, "exception")
.endDoTry()
I am getting a Cannot resolve method doCatch(...) error in my IDE (IntelliJ).
Am I not allowed to put choice predicates within doTry()?
Try this:
.doTry()
.choice()
.when(header("s").isEqualTo(1))
.log(LoggingLevel.WARN, "normal")
.endDoTry()
.doCatch(Exception.class)
.log(LoggingLevel.WARN, "exception")
.end()
I was making the same error as you not so long ago; "endDoTry" sounds like "end the doTry block" but I think it should in fact be read as "end whatever the current block is and go back to the enclosing try definition".
The same applies to "endChoice".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With