FEniCS/dolfinx

Using exception subtypes

開放

#2,398 建立於 2022年10月7日

 (2 則留言) (0 個反應) (0 位負責人)C++ (255 個分叉)auto 404
enhancementgood first issuehousekeeping

倉庫指標

星標
 (1,158 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

SonarCloud complains about our exception throwing, and I think it makes sense:

If you throw a general exception type, such as std::exception, std::logic_error or std::runtime_error, it forces consumers to catch all exceptions, including unknown exceptions they don’t necessarily know how to handle.

Instead, either throw a subtype that already exists ( for example in ), or create your own type that derives from a standard one.

https://wiki.sei.cmu.edu/confluence/display/java/ERR07-J.+Do+not+throw+RuntimeException%2C+Exception%2C+or+Throwable

貢獻者指南