raise error in one class and catch in another python code example Example 1: throwing an exception python raise Exception("message") Example 2: try pass python except: pass