try catch throw python code example
Example 1: throw error python
raise Exception("Error")
Example 2: try except raise
try:
some_code_that_may_raise_our_value_error()
except ValueError as err:
print(err.args)
raise Exception("Error")
try:
some_code_that_may_raise_our_value_error()
except ValueError as err:
print(err.args)