Exception
PYL-E071227 for retention, expected_exc in retention_map:
28 try:
29 results = parseRetentionDef(retention)
30 except expected_exc.__class__ as exc:31 self.assertEqual(
32 str(expected_exc),
33 str(exc),
For an exception to be caught, it must inherit from the Exception
class.
try:
if foo < 5:
print('foo is small')
except NotImplemented: # This is not an error class!
print('Some error occured')
try:
if foo < 5:
print('foo is small')
except NotImplementedError: # This is a valid error class
print('Some error occured')