<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to set job as failed if exception occurs in Splunk AppDynamics</title>
    <link>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720559#M2082</link>
    <description>&lt;P&gt;This may not be elegant... Try to include an assertion in the exception handling to see if it works:&lt;/P&gt;
&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;except Exception as e:
    print ("The script threw an exception.")
    assert False,"other exception"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;After the job ran, you will notice the session fails because of assertion failure.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TerenceChen_0-1703470906758.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/35566iB20DE2C13CC784FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Terence&lt;/P&gt;</description>
    <pubDate>Mon, 25 Dec 2023 02:24:22 GMT</pubDate>
    <dc:creator>tezza_chen</dc:creator>
    <dc:date>2023-12-25T02:24:22Z</dc:date>
    <item>
      <title>How to set job as failed if exception occurs</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720558#M2081</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a synthetic script that sometimes ends a run as a "broken job". I see in the documentation that this happens because of an unhandled exception.&lt;/P&gt;&lt;P&gt;So I added:&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; wait.until(EC.element_to_be_clickable((By.ID, "username"))).click()&lt;/P&gt;&lt;P&gt;except Exception as e:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print ("The script threw an exception.")&lt;/P&gt;&lt;P&gt;But now, the script runs and if the job has a timeout exception the job status shows as "success", but I can see in the script output that it printed "The script threw an exception."&lt;/P&gt;&lt;P&gt;How do I make it so that if an exception is thrown the script status shows as failed?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roberto&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 16:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720558#M2081</guid>
      <dc:creator>rbarnespancanal</dc:creator>
      <dc:date>2023-12-24T16:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to set job as failed if exception occurs</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720559#M2082</link>
      <description>&lt;P&gt;This may not be elegant... Try to include an assertion in the exception handling to see if it works:&lt;/P&gt;
&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;except Exception as e:
    print ("The script threw an exception.")
    assert False,"other exception"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;After the job ran, you will notice the session fails because of assertion failure.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TerenceChen_0-1703470906758.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/35566iB20DE2C13CC784FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Terence&lt;/P&gt;</description>
      <pubDate>Mon, 25 Dec 2023 02:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720559#M2082</guid>
      <dc:creator>tezza_chen</dc:creator>
      <dc:date>2023-12-25T02:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to set job as failed if exception occurs</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720560#M2083</link>
      <description>&lt;P&gt;Hi Terence,&lt;/P&gt;&lt;P&gt;Your solution seems to be working fine.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roberto&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 18:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/How-to-set-job-as-failed-if-exception-occurs/m-p/720560#M2083</guid>
      <dc:creator>rbarnespancanal</dc:creator>
      <dc:date>2023-12-26T18:15:06Z</dc:date>
    </item>
  </channel>
</rss>

