Perhaps the problem is caused by how Katalon handles the exception stack?
This works fine in my Keyword classes – however, I don’t use @Keyword, instead I create static methods, like this:
import com.kms.katalon.core.exception.StepErrorException as StepErrorException
public class mytools {
static void chkBoolean(boolean chk) {
if(!chk) {
throw new StepErrorException("Boolean chk is false")
}
}
static void otherMethod() { ... }
}
And in my Test Case, I call them like this:
import static mytools.*
try {
chkBoolean(whatever)
} catch (Exception e) {
// do stuff with e
// maybe throw e again
}
In fact, my whole test is contained in a Test class constructor called Test:
// imports ...
public class Test extends page_from_my_pom {
Test() {
navigateTo() // go to page_from_pom
// more steps here
}
}
try {
new Test()
passThisTest() // static method
} catch (Exception e) {
failThisTest(e.message) // static method
throw e
}
It’s a nice enough model giving me pretty good control (before handing control back to Katalon) – I hope it helps you.