Answers for "python re-raise exception"

0

python reraise

try:
    something()
except SomeError as e:
    try:
        plan_B()
    except AlsoFailsError:
        raise e  # or raise e from None - see below
Posted by: Guest on May-12-2020
-2

python: raise error

class MyError(TypeError):
    pass

raise MyError('An error happened')
Posted by: Guest on August-10-2020

Python Answers by Framework

Browse Popular Code Answers by Language