You should use a try-except keyword to capture the error and use the raise keyword to display the error message of your choice. Here's an example demonstrating the same:

try:
    a = int(input())
except:
    raise Exception('An error is being raised in the system')

Suggest An Answer

No suggestions Available!