File: exceptions.py

package info (click to toggle)
pprofile 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 512 kB
  • sloc: python: 2,928; sh: 41; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python

def trigger():
    raise Exception

def indirect():
    trigger()

# Caught exception
try:
    raise Exception
except Exception:
    pass

# Caught exception, from function
try:
    trigger()
except Exception:
    pass

# Caught exception, from deeper function
try:
    indirect()
except Exception:
    pass

# Uncaught exception, from function
try:
    trigger()
finally:
    pass

print 'Never reached'