title: failed: exceptions must derive from BaseException
body: <p>I am trying to avoid the BaseException issue here . My requirement is i have a custom exception . when the custom exception is raised, i need to do some commands and need to abort a job.</p>
  <pre><code>class custom_exp(Exception):
      def __init__(self, msg):
          self.msg = msg
      def __str__(self):
          return repr(self.msg)
  
  try:
     #calculating a threshold value 
   # if( above threshold):
       raise custom_exp(&quot;hello&quot;)
  
  except custom_exp as x:
      # have some code to store the bad records
      raise(message) # this line written to fail the job 
       
  except Exception as e:
      # have some code to store the bad records
         raise(str(e))  # this line written to fail the job 
  </code></pre>
  <p>here is the output</p>
  <pre><code>
    File &quot;C:\Users\gopia\OneDrive - VW Credit\Desktop\untitled1.py&quot;, line 11, in &lt;module&gt;
      raise(message)
  
  TypeError: exceptions must derive from BaseException
  
  </code></pre>