如何定义架构规则以防止类捕获特定的异常类型?

huangapple 未分类评论51阅读模式
英文:

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

问题

抱歉,您提供的内容涉及技术领域的特定术语和代码示例,我将按照您的要求进行翻译,以下是翻译好的部分:

我希望我能够定义一个架构规则,禁止类捕获特定的异常类型。类似于以下规则:

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

在ArchUnit中是否有实现这样的方法?

英文:

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?

huangapple
  • 本文由 发表于 2020年4月7日 06:02:07
  • 转载请务必保留本文链接:https://java.coder-hub.com/61069655.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定