title: send error string from python script to jenkins job on failure
body: <p>i have a python script which is called from <code>jenkins</code> job shell script. This python script could fail for multiple reasons. Based on the failure i need to catch the correct failure reason. I want this reason to be sent back to <code>jenkins</code> shell some how and i will post this error message through an email or some other means of notification. I tried setting a environment variable and access it in post build. But that doesn't seem to work. Any help appreciated. Below is the sample text code</p>
  
  <pre><code>#!/usr/bin/python
  a=False
  b=True
  if(a):
      raise exception("a is true")
  if(b):
      raise exception("b is true")
  </code></pre>
  
  <p>I need this <code>"a is true"</code> or <code>"b is true"</code> response sent back to <code>jenkins</code> shell and to fail the job.</p>