Raising exception from within except clause
<p>I'm wondering if we can do something like the following:<br>
We catch socket error and if the message is different than some value,<br>
 raise the exception forward to be caught on the next general except clause below?  </p>

<pre><code>try:
    some logic to connect to a server..   

except socket.error as se:
    if se.messsage != '123':
       raise Exception(se.message)
except exception as ex:
    log.error('write something')
</code></pre>

<p>You can simply re-raise the exception with <code>raise</code> without arguments:</p>

<pre><code>try:
    # some code
except:
    if condition:
        raise
</code></pre>

python exception-handling