Zum Inhalt springen

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.

def withdraw(amount)
raise "Insufficient balance" if amount > balance
end
class InsufficientFundsError < StandardError; end
def withdraw(amount)
raise InsufficientFundsError, "Insufficient balance" if amount > balance
end

Define and raise a meaningful, specific domain exception class so callers can rescue selectively.