Raise error on python exception

Author: Al-mamun Sarkar Date: 2020-03-25 16:13:12

Raise error on python exception. The following code shows how to raise an error on python exception.

try:
    raise NameError('Hey! It is a custom error message.')
except NameError as e:
    print(e)

 

Output:

Hey! It is a custom error message.