1# You can raise a error in python by using the raise keyword
2raise Exception("A error occured!")
1try:
2 someFunction()
3except Exception as ex:
4 template = "An exception of type {0} occurred. Arguments:\n{1!r}"
5 message = template.format(type(ex).__name__, ex.args)
6 print (message)
1# Raise is used to cause an error
2raise(Exception("Put whatever you want here!"))
3raise(TypeError)