summaryrefslogtreecommitdiff
path: root/tests/functional/b/broad_exception_caught.py
blob: 0a69a7015642537fb2b471ff9ef20b356c12ce70 (plain)
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
34
35
36
37
38
39
# pylint: disable=missing-docstring
__revision__ = 0

class CustomBroadException(Exception):
    pass


class CustomNarrowException(CustomBroadException):
    pass


try:
    __revision__ += 1
except Exception: # [broad-exception-caught]
    print('error')


try:
    __revision__ += 1
except BaseException: # [broad-exception-caught]
    print('error')


try:
    __revision__ += 1
except ValueError:
    print('error')


try:
    __revision__ += 1
except CustomBroadException: # [broad-exception-caught]
    print('error')


try:
    __revision__ += 1
except CustomNarrowException:
    print('error')