Let's say I set up a job in Databricks. This job runs a notebook with some Python code in it; the code performs a check, and raises an error under certain conditions: x = -1 if x < 0: raise Exception("My error message") I then set the job to send me an email notification on failure. Here is my question: how can I make the error message ("My error message" in the example above) appear in the body of the email? The syntax above causes the job to fail, but the error message does not appear in the email. I have also tried using the following, but it doesn't cause the job to fail: x = -1 if x < 0: dbutils.notebook.exit("My error message") Does anyone know if there is a way to do this please? Continue reading...