Skip to content
Sharp

Exceptions · interview question

Which naming or modeling choice is strongest for error translation?

Multiple choiceHardchapter-5-curatedpremiumexceptionserror-translation
python
try:
    response = {"subtotal": "bad-number"}
    subtotal = float(response["subtotal"])
except ValueError as error:
    raise RuntimeError("partner payload used invalid subtotal") from error
Choose one answer
Answer and explanation

Correct answer

D. Use names and structures that describe the business fact directly instead of temporary implementation noise.

Why

Clear naming and modeling shorten debugging, review, and onboarding time.

Test yourself on Exceptions

A free test with instant, explained results. No account needed.

Start free test
All Exceptions questions →