Skip to content
Sharp

Exceptions · interview question

In a payment processing API, how should exceptions be propagated?

Multiple choiceHardchapter-6-curatedpremiumexceptionschecked-vs-unchecked-exceptions
Choose one answer
Answer and explanation

Correct answer

D. Use checked exceptions for recoverable errors, log and wrap others

Why

In payment processing, using checked exceptions for recoverable errors allows the caller to handle these situations appropriately. Logging and wrapping other exceptions ensures that unexpected issues are recorded and can be addressed without crashing the application.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →