xxxxxxxxxx
try:
# Your code here
except:
raise Exception("ERROR: Some specific Error Message")
xxxxxxxxxx
#Best practive: raise statement
raise ValueError('A very specific bad thing happened')
xxxxxxxxxx
# Raise a specific exception
raise ValueError("This is a custom error message")
# Raise a generic exception
raise Exception("This is a generic error message")
xxxxxxxxxx
throw "Js error" => raise "Python error"
throw new Error("Js error object") => raise Exception("Python error object")