Jae Wilson @DataCrew
Domo

Domo + CodeEngine + Python - Error handling

June 4, 2024

Hook When your Domo CodeEngine automation silently assumes success and moves on to the next step, you're not building a workflow — you're building a time bomb. Here's how to design functions that fail loudly and correctly.

Why It Matters The difference between returning False and raising an exception is not stylistic — it's architectural. Returning False means every caller must remember to check the return value; raising an error means execution stops and the failure propagates up the stack whether or not the caller was written carefully. In automation workflows, an unhandled silent failure can cascade: you might "successfully" complete five downstream steps against an account that was never actually created. Getting this right also forces you to reason about two distinct failure modes: a malformed request that returns a 401, versus a valid request that returns an empty list — those require different responses from your code.

What You'll Learn

  • Understand why raise and return False are not interchangeable — and when each is correct
  • Design custom exception classes that carry the response object, URL, and error message for richer debugging
  • Build validation logic into route functions so unexpected API shapes are caught at the boundary
  • Distinguish between "the API returned nothing" and "the API returned an error" as separate cases worth handling separately
  • Structure CodeEngine functions so errors bubble up gracefully into Domo workflow automation