title: Control flow using try/except
body: <p>I'm a newbie when it comes to Python. I have some python code in an azure sql notebook which gets run by a scheduled job. The job notebook runs a couple of sql notebooks. If the 1st notebook errors I want an exception to be thrown so that the scheduled job shows as failed and I don't want the subsequent sql notebook to run to run. The python code is as follows</p>
  <pre><code>%python
  try:
      dbutils.notebook.run(&quot;/01. SMETS1Mig/&quot; + dbutils.widgets.get(&quot;env_parent_directory&quot;) + &quot;/02 Processing Curated Staging/02 Build - Parameterised/STA_1A - CS note Issued&quot;, 6000, {
          &quot;env_ingest_db&quot;: dbutils.widgets.get(&quot;env_ingest_db&quot;)
        , &quot;env_stg_db&quot;: dbutils.widgets.get(&quot;env_stg_db&quot;)
        , &quot;env_tech_db&quot;: dbutils.widgets.get(&quot;env_tech_db&quot;)
        })
  except :
      print ' Failure in STA_1S'
  try:
      dbutils.notebook.run(&quot;/01. SMETS1Mig/&quot; + dbutils.widgets.get(&quot;env_parent_directory&quot;) + &quot;/02 Processing Curated Staging/02 Build - Parameterised/Output CS Notes&quot;, 6000, {
          &quot;env_ingest_db&quot;: dbutils.widgets.get(&quot;env_ingest_db&quot;)
        , &quot;env_stg_db&quot;: dbutils.widgets.get(&quot;env_stg_db&quot;)
        , &quot;env_tech_db&quot;: dbutils.widgets.get(&quot;env_tech_db&quot;)
        })
  except :
      print ' Error in Output CS Notes'
  </code></pre>
  <p>Am I heading in the right direction?</p>
  <p>What's the best way to achieve this?</p>
  <p>Many Thanks in advance</p>