How to define arch rule to prohibit that classes catch specific exception types?

Viewed 147

I wish I could define an arch rule prohibiting that classes catch a given exception type. Something like the rule below:

noClasses()
    .that()
    .resideOutsideOfPackage("..repository..")
    .should()
    .catchExceptions()
    .that()
    .areAssignableTo(SQLException.class)

Is there a way to do that in ArchUnit?

0 Answers
Related