擅长:python、mysql、java
<p>下面是来自<a href="http://docs.python.org/tutorial/errors.html">docs</a>的示例:</p>
<pre><code>class MyError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
try:
raise MyError(2*2)
except MyError as e:
print 'My exception occurred, value:', e.value
</code></pre>