Generic Exception Thrown (ARCH6167)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key ruby.logging.raise-generic-exception · Severity warning · Category logging
Raising the base/generic RuntimeError instead of a specific domain exception forces callers into broad, non-selective catches. Error types become indistinguishable.
Incorrect
Section titled “Incorrect”def withdraw(amount) raise "Insufficient balance" if amount > balanceendCorrect
Section titled “Correct”class InsufficientFundsError < StandardError; end
def withdraw(amount) raise InsufficientFundsError, "Insufficient balance" if amount > balanceendDefine and raise a meaningful, specific domain exception class so callers can rescue selectively.