Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python manually trigger exception

def demo_bad_catch():
    try:
        raise ValueError('Represents a hidden bug, do not catch this')
        raise Exception('This is the exception you expect to handle')
    except Exception as error:
        print('Caught this error: ' + repr(error))

>>> demo_bad_catch()
Caught this error: ValueError('Represents a hidden bug, do not catch this',)
Comment

PREVIOUS NEXT
Code Example
Python :: how to use import command in python 
Python :: threshold meaning in pandas dropna 
Python :: how to make a pattern in python in one line 
Python :: Python NumPy ndarray.T Example to convert an array 
Python :: how to create a numpy array linspace in python 
Python :: range python start at 1 
Python :: objects and classes in python 
Python :: even in python 
Python :: Amazing Trees with python turtle 
Python :: python code to increase cpu utilization 
Python :: python word encode asci 
Python :: python website example 
Python :: numpy replace all values with another 
Python :: python read file between two strings 
Python :: Sqlalchemy Define class from existing table 
Python :: decision tree 
Python :: how to hello world in python 
Python :: convert iso 8601 to milliseconds python 
Python :: mathtext to regular python 
Python :: sudo in python 
Python :: merge two dict python 
Python :: python emoji convert 
Python :: how to install pywhatkit in pycharm 
Python :: find in python 
Python :: python resample and interpolate 
Python :: mid point circle drawing 
Python :: seaborn set figure size 
Python :: how to inheritance in python 
Python :: import modules given the full path python 
Python :: change folder name python 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =