Actionable Exceptions

Avishai Ish-Shalom (@nukemberg)

Exceptions are normal

"Normal exception"

By definition, exceptions are not normal

  • Business errors
  • System errors
  • Exceptions

Either you thought it could happen, or you didn't

Exceptions are

events

Exceptions are designed to crash & burn

  • Crash your thread
  • Crash your program
  • Inconsistent state
# cv = threading.Condition()
cv.acquire()
worker = Worker()
logger.debug("Starting work")

try:
    worker.do_something()
finally:
    cv.notify_all()

Spot the bug

Like "goto" but worse

  • Can be thrown from anywhere
  • Hard to track
  • Hard to cleanup resources
  • Heavyweight, slow

Exception are abused

Exceptions should be

Actionable

Every exception should result in a code or infrastructure change

If it's not

actionable,

It's

noise

Made with Slides.com